Spread Windows Forms 11.0 Product Documentation
DataSource Property (FpSpread)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : DataSource Property
Gets or sets the name of the data source that populates the active sheet in this component.
Syntax
'Declaration
 
Public Property DataSource As Object
'Usage
 
Dim instance As FpSpread
Dim value As Object
 
instance.DataSource = value
 
value = instance.DataSource
public object DataSource {get; set;}

Property Value

Object containing the data source
Exceptions
ExceptionDescription
Sheet count is zero; must have at least one sheet before DataSource can be set
Example
This example specifies the name of the data source that populates the active sheet.
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";
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"
See Also

Reference

FpSpread Class
FpSpread Members