# FormFieldCollection Class

> An instance of the FormFieldCollection class contains all form fields in a Text Control document represented through objects of the types TextFormField, CheckFormField and SelectionFormField. An instance of this class can only be obtained with the TextControl.FormFields property. The FormFieldCollection class implements the IEnumerable and the ICollection interface.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 28.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
- **Inherits:** `TXTextControl.TextFieldCollectionBase`
- **Implements:** `System.Collections.ICollection`, `System.Collections.IEnumerable`
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > FormFieldCollection Class
- **1417 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/llms-full.txt

---

### Description

An instance of the FormFieldCollection class contains all form fields in a Text Control document represented through objects of the types [TextFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textformfield/llms-full.txt), [CheckFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/checkformfield/llms-full.txt) and [SelectionFormField](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selectionformfield/llms-full.txt). An instance of this class can only be obtained with the [TextControl.FormFields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/formfields-property/llms-full.txt) property. The FormFieldCollection class implements the IEnumerable and the ICollection interface.

### Syntax

```csharp
public sealed class FormFieldCollection : TextFieldCollectionBase
```

```vbnet
Public NotInheritable Class FormFieldCollection
    Inherits TextFieldCollectionBase
```

### Examples

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

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
FormFieldCollection formFieldCollection = textControl.FormFields;
formFieldCollection.Add(new CheckFormField(false) { Name = "AcceptTerms", ID = 100 });
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim formFieldCollection As FormFieldCollection = textControl.FormFields
formFieldCollection.Add(New CheckFormField(False) With { .Name = "AcceptTerms", .ID = 100 })
```

---

## In This Section

- [FormFieldCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/add-method/llms-full.txt): Inserts the specified form field at the current input position.
- [FormFieldCollection.Clear Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/clear-method/llms-full.txt): Removes all form fields from a Text Control document.
- [FormFieldCollection.ConditionalInstructions Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/conditionalinstructions-property/llms-full.txt): Gets a collection of all conditional instructions that references to the form fields of the collection. The property's value is an object of type ConditionalInstructionCollection.
- [FormFieldCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/copyto-method/llms-full.txt): Copies the elements of the collection to an array, starting at a particular index.
- [FormFieldCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/getitem-method/llms-full.txt): Gets a particular form field from the collection.
- [FormFieldCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/item-property/llms-full.txt): Gets the form field with the specified number from the collection. The number must be between 1 and Count. If the specified index is invalid, null is returned. In C# this property is the indexer for the FormFieldCollection class.
- [FormFieldCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/remove-method/llms-full.txt): Removes the specified form field from a Text Control document.

---

## Nearby

- **Previous:** [FormField.FormFieldDialog Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfield/formfielddialog-method/llms-full.txt)
- **Next:** [FormFieldCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/add-method/llms-full.txt)
