# TableCollection.Add Method

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

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.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 Windows Forms > Reference > TXTextControl > TableCollection.Add Method
- **1010 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tablecollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tablecollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tablecollection/add-method/llms-full.txt

---

### Description

Adds a new table at the current text input position.

### Syntax

#### Add()

Opens a dialog box and, when left with Ok, adds a new table with the specified attributes.

```csharp
public bool Add();
```

```vbnet
Public Function Add() As Boolean
```

#### Add(int, int)

Adds a new table at the current text input position. The new table has the specified number of rows and columns.

```csharp
public bool Add(int rows, int columns);
```

```vbnet
Public Function Add(rows As Integer, columns As Integer) As Boolean
```

| Parameter | Description |
|---|---|
| rows | Specifies the number of rows the table consists of. |
| columns | Specifies the number of columns the table consists of. |

#### Add(int, int, int)

Adds a new table at the current text input position. The new table has the specified number of rows and columns. The specified identifier can be used to get the table from the collection.

```csharp
public bool Add(int rows, int columns, int id);
```

```vbnet
Public Function Add(rows As Integer, columns As Integer, id As Integer) As Boolean
```

| Parameter | Description |
|---|---|
| rows | Specifies the number of rows the table consists of. |
| columns | Specifies the number of columns the table consists of. |
| id | Specifies the table's id. |

### Return Value

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

### Examples

The following example works with tables in the current document by using `TableCollection.Add`.

```csharp
TableCollection tableCollection = textControl.Tables;

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

```vbnet
Dim tableCollection As TableCollection = textControl.Tables

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

---

## Nearby

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