Spread Windows Forms 7.0 Product Documentation
DataMember Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : DataMember Property


Glossary Item Box

Gets or sets the name of the data member that populates the active sheet in this component.

Syntax

Visual Basic (Declaration) 
Public Property DataMember As String
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim value As String
 
instance.DataMember = value
 
value = instance.DataMember
C# 
public string DataMember {get; set;}

Property Value

String containing the name of the data member

Exceptions

ExceptionDescription
System.InvalidOperationException Sheet count is zero; must have at least one sheet before the data member can be set

Example

This example specifies the name of the data member that populates the active sheet.
C#Copy Code
FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread();
FarPoint.Win.Spread.SheetView shv = new FarPoint.Win.Spread.SheetView();
fpSpread1.Location = new Point(10, 10);
fpSpread1.Height = 200;
fpSpread1.Width = 400;
Controls.Add(fpSpread1);
fpSpread1.Sheets.Add(shv);
DataSet ds = new DataSet();
DataTable emp = new DataTable("Employees");
DataTable div = new DataTable("Division");
emp.Columns.Add("LastName");
emp.Columns.Add("FirstName");
emp.Rows.Add(new Object[] {"Jones", "Marianne"});
emp.Rows.Add(new Object[] {"Fieldes", "Anna"});
div.Columns.Add("Section");
div.Columns.Add("Specialty");
div.Rows.Add(new Object[] {"Finance", "Taxes"});
div.Rows.Add(new Object[] {"Mergers", "Legal"});
ds.Tables.AddRange(new DataTable[] {emp, div});
fpSpread1.DataSource = ds;
fpSpread1.DataMember = "Division";
Visual BasicCopy Code
Dim fpSpread1 As New FarPoint.Win.Spread.FpSpread()
Dim shv As New FarPoint.Win.Spread.SheetView()
Dim info As New FarPoint.Win.Spread.StyleInfo()
info.BackColor = Color.LightBlue
fpSpread1.Location = New Point(10, 10)
fpSpread1.Height = 200
fpSpread1.Width = 400
Controls.Add(fpSpread1)
fpSpread1.Sheets.Add(shv)
Dim ds As New DataSet()
Dim emp As New DataTable("Employees")
Dim div As New DataTable("Division")
emp.Columns.Add("LastName")
emp.Columns.Add("FirstName")
emp.Rows.Add(New Object() {"Jones", "Marianne"})
emp.Rows.Add(New Object() {"Fieldes", "Anna"})
div.Columns.Add("Section")
div.Columns.Add("Specialty")
div.Rows.Add(New Object() {"Finance", "Taxes"})
div.Rows.Add(New Object() {"Mergers", "Legal"})
ds.Tables.AddRange(New DataTable() {emp, div})
fpSpread1.DataSource = ds
fpSpread1.DataMember = "Division"

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.