# TextControl.CommentStateChanged Event

> Occurs when the state of a comment alters from active to inactive or vice versa. A piece of text with an inactive comment is not highlighted and is not retrieved through the CommentCollection.GetItem method. The event handler receives an argument of type CommentEventArgs containing data related to this event.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Event
- **Introduced:** 30.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.Windows.Forms.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Windows.Forms.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > TextControl.CommentStateChanged Event
- **371 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentstatechanged-event/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentstatechanged-event/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentstatechanged-event/llms-full.txt

---

### Description

Occurs when the state of a comment alters from active to inactive or vice versa. A piece of text with an inactive comment is not highlighted and is not retrieved through the [CommentCollection.GetItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commentcollection/getitem-method/llms-full.txt) method. The event handler receives an argument of type [CommentEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/commenteventargs/llms-full.txt) containing data related to this event.

### Syntax

```csharp
public event CommentEventHandler CommentStateChanged;
```

```vbnet
Public Event CommentStateChanged As CommentEventHandler
```

### Examples

The following example records useful context when comment state changed occurs.

```csharp
textControl.CommentStateChanged += (sender, e) =>
{
    Console.WriteLine($"Comment State Changed at {DateTime.Now:u}");
};
```

```vbnet
AddHandler textControl.CommentStateChanged,
    Sub(sender, e)
        Console.WriteLine($"Comment State Changed at {DateTime.Now:u}")
    End Sub
```

---

## Nearby

- **Previous:** [TextControl.Comments Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/comments-property/llms-full.txt)
- **Next:** [TextControl.ConditionalInstructionDialog Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/conditionalinstructiondialog-method/llms-full.txt)
