TX Text Control .NET for Windows Forms

Clear Method

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

Description

Removes all hypertext links from a Text Control document.

Syntax

public void Clear(bool keepText);

Parameters

ParameterDescription
keepText

If this parameter is set to true, all hypertext links are removed without deleting their texts. Otherwise, the texts are also deleted.

Examples

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

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)
{
    hypertextLinkCollection.Clear(true);
}