# HypertextLinkCollection.Add Method

> Inserts a new hypertext link at the current input position.

- **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.Add Method
- **635 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/add-method/llms-full.txt

---

### Description

Inserts a new hypertext link at the current input position.

### Syntax

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

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

### Parameters

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

### Return Value

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

### Examples

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

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
HypertextLinkCollection hypertextLinkCollection = textControl.HypertextLinks;

if (!hypertextLinkCollection.Add(new HypertextLink("Quarterly results", "Quarterly report")))
{
    throw new InvalidOperationException("The item could not be inserted.");
}
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim hypertextLinkCollection As HypertextLinkCollection = textControl.HypertextLinks

If Not hypertextLinkCollection.Add(New HypertextLink("Quarterly results", "Quarterly report")) Then
    Throw New InvalidOperationException("The item could not be inserted.")
End If
```

---

## Nearby

- **Previous:** [HypertextLinkCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/llms-full.txt)
- **Next:** [HypertextLinkCollection.Clear Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hypertextlinkcollection/clear-method/llms-full.txt)
