# SubTextPart.Length Property

> Gets the number of characters which belong to the subtextpart.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 23.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.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 WPF > Reference > TXTextControl > SubTextPart.Length Property
- **533 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/length-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/length-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/length-property/llms-full.txt

---

### Description

Gets the number of characters which belong to the subtextpart.

### Syntax

```csharp
public int Length { get; }
```

```vbnet
Public ReadOnly Property Length As Integer
```

### Examples

The following example marks the selected customer name as a named document region by using `SubTextPart.Length`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);

textControl.Select(subTextPart.Start, subTextPart.Length);
Console.WriteLine("Sub Text Part is ready for use.");
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim subTextPart As New SubTextPart("CustomerName", 10)
textControl.SubTextParts.Add(subTextPart)

textControl.Select(subTextPart.Start, subTextPart.Length)
Console.WriteLine("Sub Text Part is ready for use.")
```

### Limitations

Read only.

---

## Nearby

- **Previous:** [SubTextPart.ID Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/id-property/llms-full.txt)
- **Next:** [SubTextPart.Name Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/name-property/llms-full.txt)
