TX Text Control .NET for Windows Forms

Add Method

Method
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Inserts a new hypertext link at the current input position.

Syntax

public bool Add(HypertextLink hypertextLink);

Parameters

ParameterDescription
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.

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.");
}