# TableOfContentsCollection.Remove Method

> Removes a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point.

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

---

### Description

Removes a table of contents from the collection including all its text and including all [DocumentTargets](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/documenttarget/llms-full.txt) to where the table's links point.

### Syntax

```csharp
public bool Remove(TableOfContents tableOfContent);
```

```vbnet
Public Function Remove(tableOfContent As TableOfContents) As Boolean
```

### Parameters

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

### Return Value

The return value is true, if the table of contents could be removed. Otherwise, it is false.

### Examples

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

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;
tableOfContentsCollection.Add(new TableOfContents(1, 3) { Name = "Contents", ID = 100 });

if (tableOfContentsCollection.Count > 0)
{
    TableOfContents tableOfContents = tableOfContentsCollection[1];
    if (tableOfContentsCollection.Remove(tableOfContents))
    {
        Console.WriteLine("The item was removed.");
    }
}
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim tableOfContentsCollection As TableOfContentsCollection = textControl.TablesOfContents
tableOfContentsCollection.Add(New TableOfContents(1, 3) With { .Name = "Contents", .ID = 100 })

If tableOfContentsCollection.Count > 0 Then
    Dim tableOfContents As TableOfContents = tableOfContentsCollection.Item(1)
    If tableOfContentsCollection.Remove(tableOfContents) Then
        Console.WriteLine("The item was removed.")
    End If
End If
```

---

## Nearby

- **Previous:** [TableOfContentsCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/item-property/llms-full.txt)
- **Next:** [TableOfContentsCollection.SyncRoot Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/syncroot-property/llms-full.txt)
