# TableRowCollection.Add Method

> Adds new table rows at the current text input position.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > TableRowCollection.Add Method
- **771 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tablerowcollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tablerowcollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tablerowcollection/add-method/llms-full.txt

---

### Description

Adds new table rows at the current text input position.

### Syntax

```csharp
public bool Add(TableAddPosition position, int count);
```

```vbnet
Public Function Add(position As TableAddPosition, count As Integer) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| position | Specifies the position where to add the rows. It can be one of the [TableAddPosition](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableaddposition/enumeration/llms-full.txt) values:  \| Value \| Meaning \| \| Before \| The rows are inserted in front of the row with the current input position. \| \| After \| The rows are inserted behind the row with the current input position. \| |
|---|

| count | Specifies the number of rows to add. |
|---|---|

### Return Value

The return value is true, if the rows could be added. Otherwise it is false.

### Examples

The following example creates a small report table and works with its structure by using `TableRowCollection.Add`.

```csharp
textControl.Tables.Add(3, 3, 10);
Table table = textControl.Tables.GetItem(10);
TableRowCollection tableRowCollection = table.Rows;

if (!tableRowCollection.Add(TableAddPosition.After, 1))
{
    throw new InvalidOperationException("The item could not be inserted.");
}
```

```vbnet
textControl.Tables.Add(3, 3, 10)
Dim table As Table = textControl.Tables.GetItem(10)
Dim tableRowCollection As TableRowCollection = table.Rows

If Not tableRowCollection.Add(TableAddPosition.After, 1) Then
    Throw New InvalidOperationException("The item could not be inserted.")
End If
```

---

## Nearby

- **Previous:** [TableRowCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tablerowcollection/llms-full.txt)
- **Next:** [TableRowCollection.CanAdd Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tablerowcollection/canadd-property/llms-full.txt)
