Spread Windows Forms 10.0 Product Documentation > Developer's Guide > Managing Data Binding > Adding to Bound Data > Adding an Unbound Row to a Bound Sheet |
Once you bind a sheet to a data set you might want to add an unbound row to contain additional data.
The following figure shows a sheet in a Spread component that contains data from a data set and an unbound row at the bottom that calculates the averages.
This example code binds the Spread component to a data set then adds an unbound row.
C# |
Copy Code
|
---|---|
// Bind the component to the data set. fpSpread1.DataSource = dbDataSet; // Add an unbound row. fpSpread1.Sheets[0].AddUnboundRows(20, 1); |
VB |
Copy Code
|
---|---|
' Bind the component to the data set. FpSpread1.DataSource = dbDataSet ' Add an unbound row. FpSpread1.Sheets(0).AddUnboundRows(20, 1) |
This example code creates a bound SheetView object and adds an unbound row to it, then assigns it to a sheet in a Spread component.
C# |
Copy Code
|
---|---|
// Create a new SheetView object. FarPoint.Win.Spread.SheetView newsheet = new FarPoint.Win.Spread.SheetView(); // Bind the SheetView object to the data set. newsheet.DataSource = dataSet1; // Add an unbound row. newsheet.AddUnboundRows(20, 1); // Assign the SheetView object to the first sheet. fpSpread1.Sheets[0] = newsheet; |
VB |
Copy Code
|
---|---|
' Create a new SheetView object. Dim newsheet As New FarPoint.Win.Spread.SheetView() ' Bind the SheetView object to the data set. newsheet.DataSource = DataSet1 ' Add an unbound row. newsheet.AddUnboundRows(20, 1) ' Assign the SheetView object to the first sheet. FpSpread1.Sheets(0) = newsheet |