# CommentCollection.Add Method

> Adds a new comment to the document.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.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 > CommentCollection.Add Method
- **726 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentcollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentcollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentcollection/add-method/llms-full.txt

---

### Description

Adds a new comment to the document.

### Syntax

#### Add()

Opens a comment input control so that the end-user can type the comment's text. The new comment is inserted after the input control has been closed.

```csharp
public CommentCollection.AddResult Add();
```

```vbnet
Public Function Add() As CommentCollection.AddResult
```

#### Add(CommentedText)

Adds a new comment given through the specified [CommentedText](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentedtext/llms-full.txt) object.The commented text is defined through the [CommentedText.Start](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentedtext/start-property/llms-full.txt) and [CommentedText.Length](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentedtext/length-property/llms-full.txt) properties. If the length of the commented text is zero, the current text selection is used to define the text associated with the comment.

```csharp
public CommentCollection.AddResult Add(CommentedText commentedText);
```

```vbnet
Public Function Add(commentedText As CommentedText) As CommentCollection.AddResult
```

| Parameter | Description |
|---|---|
| commentedText | Defines the commented text and its comment to add. |

### Return Value

The return value specifies whether the comment input control could be opened or the new comment has successfully been inserted. It can be one of the [CommentCollection.AddResult](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentcollection/addresult-enumeration/llms-full.txt) values.

### Examples

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

```csharp
CommentCollection commentCollection = textControl.Comments;

var result = commentCollection.Add(new CommentedText("Quarterly report"));
Console.WriteLine($"Add result: {result}");
```

```vbnet
Dim commentCollection As CommentCollection = textControl.Comments

Dim result = commentCollection.Add(New CommentedText("Quarterly report"))
Console.WriteLine($"Add result: {result}")
```

---

## Nearby

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