# SubTextPartEventArgs Class

> The SubTextPartEventArgs class provides data for the SubTextPartClicked, SubTextPartCreated, SubTextPartDeleted, SubTextPartDoubleClicked, SubTextPartEntered and SubTextPartLeft events. When subtextpart is deleted, the SubTextPart object provided with the event data has the following valid properties: HighlightColor, HighlightMode, ID and Name. All other properties are undefined.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 23.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
- **Inherits:** `System.EventArgs`
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > SubTextPartEventArgs Class
- **589 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextparteventargs/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextparteventargs/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextparteventargs/llms-full.txt

---

### Description

The SubTextPartEventArgs class provides data for the [SubTextPartClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartclicked-event/llms-full.txt), [SubTextPartCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartcreated-event/llms-full.txt), [SubTextPartDeleted](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartdeleted-event/llms-full.txt), [SubTextPartDoubleClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartdoubleclicked-event/llms-full.txt), [SubTextPartEntered](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartentered-event/llms-full.txt) and [SubTextPartLeft](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartleft-event/llms-full.txt) events. When subtextpart is deleted, the [SubTextPart](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpart/llms-full.txt) object provided with the event data has the following valid properties: HighlightColor, HighlightMode, ID and Name. All other properties are undefined.

### Syntax

```csharp
public class SubTextPartEventArgs : EventArgs
```

```vbnet
Public Class SubTextPartEventArgs
    Inherits EventArgs
```

### Examples

The following example uses `SubTextPartEventArgs.SubTextPart` while handling `SubTextPartCreated`.

```csharp
textControl.SubTextPartCreated += (_, e) =>
{
    e.SubTextPart?.ScrollTo();
};
```

```vbnet
AddHandler textControl.SubTextPartCreated,
    Sub(sender, e)
        If e.SubTextPart IsNot Nothing Then e.SubTextPart.ScrollTo()
    End Sub
```

---

## In This Section

- [SubTextPartEventArgs.SubTextPart Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextparteventargs/subtextpart-property/llms-full.txt): Gets an object that represents the subtextpart which causes the event. It is of the type SubTextPart.

---

## Nearby

- **Previous:** [SubTextPartCollection.SyncRoot Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextpartcollection/syncroot-property/llms-full.txt)
- **Next:** [SubTextPartEventArgs.SubTextPart Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/subtextparteventargs/subtextpart-property/llms-full.txt)
