# TableOfContentsCollection.GetItem Method

> Gets a particular table of contents from the collection.

- **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.GetItem Method
- **1113 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/getitem-method/llms-full.txt

---

### Description

Gets a particular table of contents from the collection.

### Syntax

#### GetItem()

Gets the table of contents at the current text input position. If there is no table of contents, null is returned.

```csharp
public TableOfContents GetItem();
```

```vbnet
Public Function GetItem() As TableOfContents
```

#### GetItem(string)

Gets the table of contents with the specified name. The method returns null, if such a table of contents does not exist. If more than one table of contents with this name exists, the first found table of contents is returned.

```csharp
public TableOfContents GetItem(string name);
```

```vbnet
Public Function GetItem(name As String) As TableOfContents
```

| Parameter | Description |
|---|---|
| name | Specifies the name set with the Name property. The method returns null if a table of contents with the specified name does not exist. |

#### GetItem(int)

Gets the table of contents with the specified id. The method returns null, if such a table of contents does not exist. If more than one table of contents with this id exists, the first found table of contents is returned.

```csharp
public TableOfContents GetItem(int id);
```

```vbnet
Public Function GetItem(id As Integer) As TableOfContents
```

| Parameter | Description |
|---|---|
| id | Specifies the identifier of the table of contents. The method returns null if a table of contents with the specified identifier does not exist. |

### Return Value

The return value is null, if a table of contents with the specified parameters could not be found. Otherwise, it is an object of the type [TableOfContents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontents/llms-full.txt).

### Examples

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

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

TableOfContents result = tableOfContentsCollection.GetItem(100);
result?.ScrollTo();
```

```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 })

Dim result As TableOfContents = tableOfContentsCollection.GetItem(100)
If result IsNot Nothing Then result.ScrollTo()
```

---

## Nearby

- **Previous:** [TableOfContentsCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/getenumerator-method/llms-full.txt)
- **Next:** [TableOfContentsCollection.IsSynchronized Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tableofcontentscollection/issynchronized-property/llms-full.txt)
