[]
You can bind the Spread component to a data set. When you bind the component using the default settings, data from the data set is read into the columns and rows of the sheet to which you bind the data. Columns are associated with fields, and rows represent each record in the data set.
You can also bind a sheet, column, or cell range.
The following instructions provide the code necessary to bind the Spread component to a data set. For a tutorial that can introduce you to the procedure for data binding, refer to the Tutorial: Binding to a Corporate Database (Visual Studio 2013 or later).
For more information, refer to the AddRowToDataSource and BindDataColumn methods.
If you want to re-order the columns in a data set, move around the columns in the Spread after the bind. Use the BindDataColumn method in the SheetView class to do this.
There are many alternative ways to set up data binding. To learn more about data binding in Visual Studio .NET, consult the Visual Studio .NET documentation.
Create your data set.
In the Properties window select the Spread component.
To set the data source for the component, set the DataSource property.
To set the data source for the sheet,
Select the Sheets property for the Spread component.
Click the button to display the SheetView Collection Editor.
Select the sheet for which to set the data source.
Set the DataSource property for that sheet.
Create your data set.
Set the FpSpread DataSource or SheetView DataSource property equal to the data set.
This example code binds the Spread component to a data set named "dbDataSet".
// Bind the component to the data set.
fpSpread1.Sheets[0].AutoGenerateColumns = false;
fpSpread1.Sheets[0].DataSource = dbDataSet;
fpSpread1.Sheets[0].ColumnCount = 2;
fpSpread1.Sheets[0].BindDataColumn(0, "ID");
fpSpread1.Sheets[0].BindDataColumn(1, "Description");
' Bind the component to the data set.
fpSpread1.Sheets(0).AutoGenerateColumns = False
fpSpread1.Sheets(0).DataSource = dbDataSet
fpSpread1.Sheets(0).ColumnCount = 2
fpSpread1.Sheets(0).BindDataColumn(0, "ID")
fpSpread1.Sheets(0).BindDataColumn(1, "Description")
Binding a Cell Range in Spread to an External Data Source
Binding a Cell Range in Spread as a Data Source to an External Control