# ApplicationFieldCollection.Remove Method

> Removes a field of the type ApplicationField from a TX Text Control document.

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

---

### Description

Removes a field of the type [ApplicationField](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfield/llms-full.txt) from a TX Text Control document.

### Syntax

#### Remove(ApplicationField)

Removes a field of the type [ApplicationField](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfield/llms-full.txt) including its visible text from a TX Text Control document.

```csharp
public bool Remove(ApplicationField applicationField);
```

```vbnet
Public Function Remove(applicationField As ApplicationField) As Boolean
```

| Parameter | Description |
|---|---|
| applicationField | Specifies the field to remove. |

#### Remove(ApplicationField, bool)

Removes a field of the type [ApplicationField](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfield/llms-full.txt) from a TX Text Control document. The visible text is deleted depending on the keepText parameter.

```csharp
public bool Remove(ApplicationField applicationField, bool keepText);
```

```vbnet
Public Function Remove(applicationField As ApplicationField, keepText As Boolean) As Boolean
```

| Parameter | Description |
|---|---|
| applicationField | Specifies the field to remove. |
| keepText | If this parameter is set to true, the field is removed without deleting its visible text. Otherwise, the field's text is also deleted. |

### Return Value

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

### Examples

The following example removes a merge field while keeping its current result text in the document.

```csharp
textControl.Text = "Dear ,";
textControl.InputPosition = new InputPosition(5);
ApplicationFieldCollection fields = textControl.ApplicationFields;
ApplicationField customerField = new(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" }) { ID = 100 };
fields.Add(customerField);
fields.Remove(customerField, true);
```

```vbnet
textControl.Text = "Dear ,"
textControl.InputPosition = New InputPosition(5)
Dim fields As ApplicationFieldCollection = textControl.ApplicationFields
Dim customerField As New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" }) With { .ID = 100 }
fields.Add(customerField)
fields.Remove(customerField, True)
```

---

## Nearby

- **Previous:** [ApplicationFieldCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldcollection/item-property/llms-full.txt)
- **Next:** [ApplicationFieldFormat Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/applicationfieldformat/enumeration/llms-full.txt)
