# CommentCollection.Remove Method

> Removes a CommentedText from the collection. The method removes the saved position values and the comment string. The text, which is commented, is not removed from the document.

- **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.Remove Method
- **815 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentcollection/remove-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentcollection/remove-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentcollection/remove-method/llms-full.txt

---

### Description

Removes a [CommentedText](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentedtext/llms-full.txt) from the collection. The method removes the saved position values and the comment string. The text, which is commented, is not removed from the document.

### Syntax

```csharp
public bool Remove(CommentedText commentedText);
```

```vbnet
Public Function Remove(commentedText As CommentedText) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| commentedText | Specifies the [CommentedText](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/commentedtext/llms-full.txt) to remove. |

### Return Value

The return value is true, if the comment could be removed. Otherwise, it is false.

### Examples

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

```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."));

if (commentCollection.Count > 0)
{
    CommentedText commentedText = commentCollection[1];
    if (commentCollection.Remove(commentedText))
    {
        Console.WriteLine("The item was removed.");
    }
}
```

```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."))

If commentCollection.Count > 0 Then
    Dim commentedText As CommentedText = commentCollection.Item(1)
    If commentCollection.Remove(commentedText) Then
        Console.WriteLine("The item was removed.")
    End If
End If
```

---

## Nearby

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