# DocumentTargetCollection.Remove Method

> Removes the specified target from a Text Control document.

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

---

### Description

Removes the specified target from a Text Control document.

### Syntax

```csharp
public bool Remove(DocumentTarget documentTarget);
```

```vbnet
Public Function Remove(documentTarget As DocumentTarget) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| documentTarget | Specifies the document target to remove. |

### Return Value

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

### Examples

The following example works with document targets in the current document by using `DocumentTargetCollection.Remove`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentTargetCollection documentTargetCollection = textControl.DocumentTargets;
documentTargetCollection.Add(new DocumentTarget("CustomerDetails") { ID = 100 });

if (documentTargetCollection.Count > 0)
{
    DocumentTarget documentTarget = documentTargetCollection[1];
    if (documentTargetCollection.Remove(documentTarget))
    {
        Console.WriteLine("The item was removed.");
    }
}
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim documentTargetCollection As DocumentTargetCollection = textControl.DocumentTargets
documentTargetCollection.Add(New DocumentTarget("CustomerDetails") With { .ID = 100 })

If documentTargetCollection.Count > 0 Then
    Dim documentTarget As DocumentTarget = documentTargetCollection.Item(1)
    If documentTargetCollection.Remove(documentTarget) Then
        Console.WriteLine("The item was removed.")
    End If
End If
```

---

## Nearby

- **Previous:** [DocumentTargetCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/documenttargetcollection/item-property/llms-full.txt)
- **Next:** [DocumentTargetCollection.SyncRoot Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/documenttargetcollection/syncroot-property/llms-full.txt)
