Spread Windows Forms 12.0 Product Documentation
Adding an Unbound Row to a Bound Sheet
Spread Windows Forms 12.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.

Sheet with unbound row

Using a Shortcut

  1. Create your data set.
  2. Set the FpSpread object's or Sheet object's DataSource property equal to the data set.
  3. Call the Sheet object's AddUnboundRows method to specify where to add the unbound row.
  4. Set properties for the unbound row.

Example

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)

Using Code

  1. Create your data set.
  2. Create a new SheetView object.
  3. Set the SheetView object's DataSource property equal to the data set.
  4. Call the SheetView object's AddUnboundRows method to specify where to add the unbound row.
  5. Set properties for the unbound row.
  6. Assign the SheetView object to a sheet in the component.

Example

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
See Also