# DocumentLink Class

> The DocumentLink class represents a link in a Text Control document that points to a target in the same document. For more information see the technical article Text Fields and Hypertext Links.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **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
- **Inherits:** `TXTextControl.TextField`
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > DocumentLink Class
- **2812 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/llms-full.txt

---

### Description

The DocumentLink class represents a link in a Text Control document that points to a target in the same document. For more information see the technical article Text Fields and Hypertext Links.

### Syntax

```csharp
public class DocumentLink : TextField
```

```vbnet
Public Class DocumentLink
    Inherits TextField
```

### Examples

The following example shows how to insert a DocumentTarget and a corresponding DocumentLink into a document.

```csharp
textControl1.ViewMode = TXTextControl.ViewMode.PageView;
textControl1.Text = "Page 1\fPage 2\fPage 3";
textControl1.Select(3, 0);

TXTextControl.DocumentTarget newTarget = new TXTextControl.DocumentTarget("Page1");

textControl1.DocumentTargets.Add(newTarget);
textControl1.InputPosition = new TXTextControl.InputPosition(2, 1, 3);
TXTextControl.DocumentLink newLink = new TXTextControl.DocumentLink("Jump to page 1", newTarget);
textControl1.DocumentLinks.Add(newLink);
```

```vbnet
TextControl1.ViewMode = TXTextControl.ViewMode.PageView
TextControl1.Text = "Page 1" + Chr(12) + "Page 2" + Chr(12) + "Page 3"
TextControl1.Select(3, 0)

Dim newTarget As TXTextControl.DocumentTarget = New TXTextControl.DocumentTarget("Page1")

TextControl1.DocumentTargets.Add(newTarget)
TextControl1.InputPosition = New TXTextControl.InputPosition(2, 1, 3)
Dim newLink As TXTextControl.DocumentLink = New TXTextControl.DocumentLink("Jump to page 1", newTarget)
TextControl1.DocumentLinks.Add(newLink)
```

The following example creates an internal link to the customer-details destination.

```csharp
DocumentTarget target = new("CustomerDetails");
textControl.DocumentTargets.Add(target);
DocumentLink documentLink = new("View customer details", target);
textControl.DocumentLinks.Add(documentLink);
```

```vbnet
Dim target As New DocumentTarget("CustomerDetails")
textControl.DocumentTargets.Add(target)
Dim documentLink As New DocumentLink("View customer details", target)
textControl.DocumentLinks.Add(documentLink)
```

---

## In This Section

- [DocumentLink.AutoGenerationType Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/autogenerationtype-property/llms-full.txt): Gets the type of auto-generation. A document link in a table of contents is automatically generated when the table of contents is inserted into the document.
- [DocumentLink Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/constructor/llms-full.txt): Initializes a new instance of the DocumentLink class.
- [DocumentLink.DescriptiveText Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/descriptivetext-property/llms-full.txt): Gets or sets a descriptive text for a document link. An empty string indicates that the document link has no such text. An empty string can also be used to delete a previously set text.
- [DocumentLink.DocumentTarget Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/documenttarget-property/llms-full.txt): Gets or sets an object of the type DocumentTarget specifying to where the link points. If such an object does not exist, the property returns null.

---

## Nearby

- **Previous:** [Direction Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/direction/enumeration/llms-full.txt)
- **Next:** [DocumentLink.AutoGenerationType Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentlink/autogenerationtype-property/llms-full.txt)
