# TableOfContentsCollection.Add Method

> Adds a new table of contents to the document at the current text input position.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.0
- **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 > TableOfContentsCollection.Add Method
- **621 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/add-method/llms-full.txt

---

### Description

Adds a new table of contents to the document at the current text input position.

### Syntax

```csharp
public TableOfContentsCollection.AddResult Add(TableOfContents tableOfContent);
```

```vbnet
Public Function Add(tableOfContent As TableOfContents) As TableOfContentsCollection.AddResult
```

### Parameters

| Parameter | Description |
|---|---|
| tableOfContent | Specifies the table of contents to add. |

### Return Value

The return value specifies whether the new table of contents has successfully been inserted. It can be one of the [TableOfContentsCollection.AddResult](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/addresult-enumeration/llms-full.txt) values.

### Examples

The following example works with tables of contents in the current document by using `TableOfContentsCollection.Add`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;

var result = tableOfContentsCollection.Add(new TableOfContents(10, 10));
Console.WriteLine($"Add result: {result}");
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim tableOfContentsCollection As TableOfContentsCollection = textControl.TablesOfContents

Dim result = tableOfContentsCollection.Add(New TableOfContents(10, 10))
Console.WriteLine($"Add result: {result}")
```

---

## Nearby

- **Previous:** [TableOfContentsCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/llms-full.txt)
- **Next:** [TableOfContentsCollection.AddResult Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/addresult-enumeration/llms-full.txt)
