# FormFieldCollection.Remove Method

> Removes the specified form field from a Text Control document.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **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
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > FormFieldCollection.Remove Method
- **951 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/remove-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/remove-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/remove-method/llms-full.txt

---

### Description

Removes the specified form field from a Text Control document.

### Syntax

#### Remove(FormField)

Removes the specified form field from a Text Control document.

```csharp
public bool Remove(FormField formField);
```

```vbnet
Public Function Remove(formField As FormField) As Boolean
```

| Parameter | Description |
|---|---|
| formField | Specifies the formr field to remove. |

#### Remove(FormField, bool)

```csharp
public bool Remove(FormField formField, bool keepText);
```

```vbnet
Public Function Remove(formField As FormField, keepText As Boolean) As Boolean
```

### Return Value

The return value is true, if the form field could be removed. Otherwise it is false.

### Examples

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

```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)
{
    FormField formField = formFieldCollection[1];
    if (formFieldCollection.Remove(formField))
    {
        Console.WriteLine("The item was removed.");
    }
}
```

```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
    Dim formField As FormField = formFieldCollection.Item(1)
    If formFieldCollection.Remove(formField) Then
        Console.WriteLine("The item was removed.")
    End If
End If
```

---

## Nearby

- **Previous:** [FormFieldCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/item-property/llms-full.txt)
- **Next:** [FormFieldEventArgs Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldeventargs/llms-full.txt)
