# FormFieldCollection.Clear Method

> Removes all form fields from a Text Control document.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.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 > FormFieldCollection.Clear Method
- **544 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/formfieldcollection/clear-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/formfieldcollection/clear-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/formfieldcollection/clear-method/llms-full.txt

---

### Description

Removes all form fields from a Text Control document.

### Syntax

```csharp
public void Clear();
```

```vbnet
Public Sub Clear()
```

### Examples

The following example works with form fields in the current document by using `FormFieldCollection.Clear`.

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

if (formFieldCollection.Count > 0)
{
    formFieldCollection.Clear();
}
```

```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 })

If formFieldCollection.Count > 0 Then
    formFieldCollection.Clear()
End If
```

---

## Nearby

- **Previous:** [FormFieldCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/formfieldcollection/add-method/llms-full.txt)
- **Next:** [FormFieldCollection.ConditionalInstructions Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/formfieldcollection/conditionalinstructions-property/llms-full.txt)
