# SubTextPart.GetTextFields Method

> Returns an array of TextField objects which are completely contained in this SubTextPart. The objects' type depend on the fieldType parameter.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.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 > SubTextPart.GetTextFields Method
- **693 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/subtextpart/gettextfields-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/subtextpart/gettextfields-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/subtextpart/gettextfields-method/llms-full.txt

---

### Description

Returns an array of TextField objects which are completely contained in this SubTextPart. The objects' type depend on the fieldType parameter.

### Syntax

```csharp
public TextField[] GetTextFields(TextFieldType fieldType);
```

```vbnet
Public Function GetTextFields(fieldType As TextFieldType) As TextField()
```

### Parameters

| Parameter | Description |
|---|---|
| fieldType | Specifies types of text fields. It can be a combination of the [TextFieldType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textfieldtype/enumeration/llms-full.txt) values. |

### Return Value

The return value is null if this SubTextPart has no textfields. Otherwise, it is an array of objects of the type specified through the fieldType parameter.

### Examples

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

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

TextField[] results = subTextPart.GetTextFields(TextFieldType.HypertextLink);
foreach (TextField textField in results)
{
    Console.WriteLine(textField);
}
```

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

Dim results As TextField() = subTextPart.GetTextFields(TextFieldType.HypertextLink)
For Each textField As TextField In results
    Console.WriteLine(textField)
Next
```

---

## Nearby

- **Previous:** [SubTextPart.GetChildren Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/subtextpart/getchildren-method/llms-full.txt)
- **Next:** [SubTextPart.HighlightColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/subtextpart/highlightcolor-property/llms-full.txt)
