# CommentCollection.GetItem Method

> Gets a particular item from the collection.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.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 Server > Reference > TXTextControl > CommentCollection.GetItem Method
- **830 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentcollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentcollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentcollection/getitem-method/llms-full.txt

---

### Description

Gets a particular item from the collection.

### Syntax

#### GetItem()

Gets the comment at the current text input position. If there is more than one comment at the current text input position the innermost comment is returned.

```csharp
public CommentedText GetItem();
```

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

#### GetItem(bool)

Gets the next or the previous comment in the textflow. The search begins at the current text input position.

```csharp
public CommentedText GetItem(bool next);
```

```vbnet
Public Function GetItem([next] As Boolean) As CommentedText
```

| Parameter | Description |
|---|---|
| next | If this parameter is true, the next comment in the textflow is returned. If this parameter is false, the previous comment in the textflow is returned. The next or the previous comment is returned independent whether there is a comment at the current text input position. |

### Return Value

The return value is null, if a comment could not be found. Otherwise, it is an object of the type [CommentedText](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentedtext/llms-full.txt).

### Examples

The following example works with comments in the current document by using `CommentCollection.get_Item`.

```csharp
CommentCollection commentCollection = textControl.Comments;
textControl.Text = "Payment is due within 30 days.";
textControl.Select(0, textControl.Text.Length);
commentCollection.Add(new CommentedText("Verify the payment term."));

CommentedText result = commentCollection.GetItem();
result?.ScrollTo();
```

```vbnet
Dim commentCollection As CommentCollection = textControl.Comments
textControl.Text = "Payment is due within 30 days."
textControl.Select(0, textControl.Text.Length)
commentCollection.Add(New CommentedText("Verify the payment term."))

Dim result As CommentedText = commentCollection.GetItem()
If result IsNot Nothing Then result.ScrollTo()
```

---

## Nearby

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