# ApplicationFieldCollection Class

> An instance of the ApplicationFieldCollection class contains all created or imported Microsoft Word or Heiler HighEdit fields represented through objects of the type ApplicationField. An instance of this class can be obtained with the TextControl.ApplicationFields property. The collection can contain fields in different formats. Currently supported formats are Microsoft Word fields and Heiler HighEdit fields. The ApplicationFieldCollection class implements the IEnumerable and the ICollection interfaces. For more information see the technical article Text Fields and Hypertext Links - Importing Fields from Microsoft Word.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 14.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
- **Inherits:** `TXTextControl.TextFieldCollectionBase`
- **Implements:** `System.Collections.ICollection`, `System.Collections.IEnumerable`
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > ApplicationFieldCollection Class
- **1884 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/llms-full.txt

---

### Description

An instance of the ApplicationFieldCollection class contains all created or imported Microsoft Word or Heiler HighEdit fields represented through objects of the type [ApplicationField](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfield/llms-full.txt). An instance of this class can be obtained with the [TextControl.ApplicationFields](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/applicationfields-property/llms-full.txt) property. The collection can contain fields in different formats. Currently supported formats are Microsoft Word fields and Heiler HighEdit fields. The ApplicationFieldCollection class implements the IEnumerable and the ICollection interfaces. For more information see the technical article Text Fields and Hypertext Links - Importing Fields from Microsoft Word.

### Syntax

```csharp
public sealed class ApplicationFieldCollection : TextFieldCollectionBase
```

```vbnet
Public NotInheritable Class ApplicationFieldCollection
    Inherits TextFieldCollectionBase
```

### Examples

The following example iterates through all fields and sets the visible text of the address field:

```csharp
foreach (TXTextControl.ApplicationField myApplicationField in textControl1.ApplicationFields)
{
    if (myApplicationField.TypeName == "MERGEFIELD" && myApplicationField.Parameters[0] == "Address")
    {
        myApplicationField.Text = "Bakerstreet, London";
    }
}
```

```vbnet
For Each MyApplicationField As TXTextControl.ApplicationField In TextControl1.ApplicationFields
    If MyApplicationField.TypeName = "MERGEFIELD" And MyApplicationField.Parameters(0) = "Address" Then
        MyApplicationField.Text = "Bakerstreet, London"
    End If
Next
```

The following example works with application fields in the current document.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
ApplicationFieldCollection applicationFieldCollection = textControl.ApplicationFields;
ApplicationField field = new(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" });
applicationFieldCollection.Add(field);
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim applicationFieldCollection As ApplicationFieldCollection = textControl.ApplicationFields
Dim field As New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" })
applicationFieldCollection.Add(field)
```

---

## In This Section

- [ApplicationFieldCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/add-method/llms-full.txt): Inserts a new object of the type ApplicationField at the current input position.
- [ApplicationFieldCollection.Clear Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/clear-method/llms-full.txt): Removes all fields of the type ApplicationField from a TX Text Control document.
- [ApplicationFieldCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/copyto-method/llms-full.txt): Copies the elements of the collection to an array, starting at a particular index.
- [ApplicationFieldCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/getitem-method/llms-full.txt): Gets a particular field of the type ApplicationField from the collection.
- [ApplicationFieldCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/item-property/llms-full.txt): Gets the field with the specified number from the collection. The number must be between 1 and Count. In C# this property is the indexer for the ApplicationFieldCollection class.
- [ApplicationFieldCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/remove-method/llms-full.txt): Removes a field of the type ApplicationField from a TX Text Control document.

---

## Nearby

- **Previous:** [ApplicationField.TypeName Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfield/typename-property/llms-full.txt)
- **Next:** [ApplicationFieldCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/add-method/llms-full.txt)
