# HypertextLinkCollection.Remove Method

> Removes a hypertext link from a Text Control document.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.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 Windows Forms > Reference > TXTextControl > HypertextLinkCollection.Remove Method
- **1091 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/remove-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/remove-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/remove-method/llms-full.txt

---

### Description

Removes a hypertext link from a Text Control document.

### Syntax

#### Remove(HypertextLink)

Removes a hypertext link including its visible text from a Text Control document.

```csharp
public bool Remove(HypertextLink hypertextLink);
```

```vbnet
Public Function Remove(hypertextLink As HypertextLink) As Boolean
```

| Parameter | Description |
|---|---|
| hypertextLink | Specifies the hypertext link to remove. |

#### Remove(HypertextLink, bool)

Removes a hypertext link from a Text Control document. The visible text is deleted depending on the keepText parameter.

```csharp
public bool Remove(HypertextLink hypertextLink, bool keepText);
```

```vbnet
Public Function Remove(hypertextLink As HypertextLink, keepText As Boolean) As Boolean
```

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

### Return Value

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

### Examples

The following example works with hypertext links in the current document by using `HypertextLinkCollection.Remove`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
HypertextLinkCollection hypertextLinkCollection = textControl.HypertextLinks;
hypertextLinkCollection.Add(new HypertextLink("Documentation", "https://docs.textcontrol.com/") { ID = 100 });

if (hypertextLinkCollection.Count > 0)
{
    HypertextLink hypertextLink = hypertextLinkCollection[1];
    if (hypertextLinkCollection.Remove(hypertextLink))
    {
        Console.WriteLine("The item was removed.");
    }
}
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim hypertextLinkCollection As HypertextLinkCollection = textControl.HypertextLinks
hypertextLinkCollection.Add(New HypertextLink("Documentation", "https://docs.textcontrol.com/") With { .ID = 100 })

If hypertextLinkCollection.Count > 0 Then
    Dim hypertextLink As HypertextLink = hypertextLinkCollection.Item(1)
    If hypertextLinkCollection.Remove(hypertextLink) Then
        Console.WriteLine("The item was removed.")
    End If
End If
```

---

## Nearby

- **Previous:** [HypertextLinkCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/item-property/llms-full.txt)
- **Next:** [HypertextLinkEventArgs Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkeventargs/llms-full.txt)
