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 document link at the current input position.

Syntax

public bool Add(DocumentLink documentLink);

Parameters

ParameterDescription
documentLink

Specifies the document link to add.

Return Value

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

Examples

The following example works with document links in the current document by using DocumentLinkCollection.Add.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentLinkCollection documentLinkCollection = textControl.DocumentLinks;

if (!documentLinkCollection.Add(new DocumentLink("Quarterly results", new DocumentTarget("CustomerName"))))
{
    throw new InvalidOperationException("The item could not be inserted.");
}