# Adding a Row to a Bound Sheet

Learn how to add unbound rows to a bound sheet and bind them using the AddRowToDataSource method. Enhance your data manipulation skills with Spread for .NET.

## Content

Once you bind a sheet to a data set you might want to add an unbound row to contain additional data. The row could then be bound using the [AddRowToDataSource](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.AddRowToDataSource.html) method.
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.
![Spreadsheet displaying bound data and an unbound row at the bottom](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/dsunboundformula.png)

## Using Code

1. Create your data set.
2. Set the **FpSpread** object's [DataSource](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.DataSource.html) property equal to the data set.
3. Call the **SheetView** object's [AddUnboundRows](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.AddUnboundRows.html) method to specify where to add the unbound row.
4. Set properties for the unbound row.
5. Set the **SheetView** object's [AddRowToDataSource](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.AddRowToDataSource.html) method if you want to add the row to the data source.

## Example

This example code creates a bound **FpSpread** object and adds an unbound row to it.

```csharp
DataSet ds = new DataSet();
DataTable emp = new DataTable("Name");
emp.Columns.Add("LastName");
emp.Columns.Add("GPA (Single)", typeof(decimal));
emp.Columns.Add("GPA (Double)", typeof(decimal));
emp.Rows.Add(new Object[] { "Shorter", "4.12", "4.12" });
emp.Rows.Add(new Object[] { "Williams", "2.00", "2.00" });
emp.Rows.Add(new Object[] { "Zacheius", "3.62", "3.62" });
ds.Tables.Add(emp);
fpSpread1.DataSource = ds;
fpSpread1.ActiveSheet.AddUnboundRows(3, 1);
fpSpread1.ActiveSheet.Cells[3, 0].Text = "Average";
fpSpread1.ActiveSheet.Cells[3, 1].Formula = "AVERAGE(B1:B3)";
fpSpread1.ActiveSheet.Cells[3, 2].Formula = "AVERAGE(C1:C3)";
//fpSpread1.ActiveSheet.AddRowToDataSource(3, true);
```

```vbnet
Dim ds = New DataSet()
Dim emp As New DataTable("Name")
emp.Columns.Add("LastName")
emp.Columns.Add("GPA (Single)", GetType(Decimal))
emp.Columns.Add("GPA (Double)", GetType(Decimal))
emp.Rows.Add(New Object() {"Shorter", "4.12", "4.12"})
emp.Rows.Add(New Object() {"Williams", "2.00", "2.00"})
emp.Rows.Add(New Object() {"Zacheius", "3.62", "3.62"})
ds.Tables.Add(emp)
fpSpread1.DataSource = ds
fpSpread1.ActiveSheet.AddUnboundRows(3, 1)
fpSpread1.ActiveSheet.Cells(3, 0).Text = "Average"
fpSpread1.ActiveSheet.Cells(3, 1).Formula = "AVERAGE(B1:B3)"
fpSpread1.ActiveSheet.Cells(3, 2).Formula = "AVERAGE(C1:C3)"
'fpSpread1.ActiveSheet.AddRowToDataSource(3, True)
```

## See Also

[Adding an Unbound Row to a Bound Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-data-binding/spwin-databind-adds/spwin-databind-unboundrow)