# IFormattedText.GetTextFields Method

> Returns a collection containing text fields of the specified types.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 24.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 > IFormattedText.GetTextFields Method
- **506 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/iformattedtext/gettextfields-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/iformattedtext/gettextfields-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/iformattedtext/gettextfields-method/llms-full.txt

---

### Description

Returns a collection containing text fields of the specified types.

### Syntax

```csharp
TextFieldCollection GetTextFields(TextFieldType fieldType);
```

```vbnet
Function GetTextFields(fieldType As TextFieldType) As TextFieldCollection
```

### 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-winforms/reference/txtextcontrol/textfieldtype/enumeration/llms-full.txt) values. |

### Return Value

The return value is a collection of all fields of the specified types.

### Examples

The following example applies bold formatting through the iformatted text's selection by using `IFormattedText.get_TextFields`.

```csharp
Selection formattedSelection = iFormattedText.Selection;
formattedSelection.Bold = true;
iFormattedText.Selection = formattedSelection;

var result = iFormattedText.GetTextFields(TextFieldType.HypertextLink);
Console.WriteLine($"Get Text Fields result: {result}");
```

```vbnet
Dim formattedSelection As Selection = iFormattedText.Selection
formattedSelection.Bold = True
iFormattedText.Selection = formattedSelection

Dim result = iFormattedText.GetTextFields(TextFieldType.HypertextLink)
Console.WriteLine($"Get Text Fields result: {result}")
```

---

## Nearby

- **Previous:** [IFormattedText.Frames Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/iformattedtext/frames-property/llms-full.txt)
- **Next:** [IFormattedText.HypertextLinks Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/iformattedtext/hypertextlinks-property/llms-full.txt)
