Removes all document links from a Text Control document.

Introduced: 13.0.

Clear(Bool)

public void Clear(bool keepText);
Public Sub Clear(ByVal keepText As Boolean)

Parameters

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

Examples

The following example shows how to use the TXTextControl.DocumentLinkCollection.Clear Method.

textControl1.DocumentLinks.Clear(false);
textBox1.AppendText("The textControl1.DocumentTargets has been cleared, the content of the collection is: " + Environment.NewLine + Environment.NewLine);
if (textControl1.DocumentLinks.Count != 0)
{
    foreach (TXTextControl.DocumentLink documentLink in textControl1.DocumentLinks)
    {
        textBox1.Text = "Name:  " + documentLink.Name + Environment.NewLine +
                            "Text:  " + documentLink.Text + Environment.NewLine +
                            "ID: " + documentLink.ID.ToString() + Environment.NewLine + Environment.NewLine";  

}

else
textBox1.Text = "<<< DocumentLinkss Collection Test >>>" + Environment.NewLine +
                "The DocumentLinkss Collection Count Property in textControl1 is: " + textControl1.DocumentLinks.Count.ToString()";
textControl1.DocumentLinks.Clear(False)
textBox1.AppendText("The textControl1.DocumentTargets has been cleared, the content of the collection is: " & Environment.NewLine + Environment.NewLine)

If textControl1.DocumentLinks.Count <> 0 Then

    For Each documentLink As TXTextControl.DocumentLink In textControl1.DocumentLinks
        textBox1.Text = "Name:  " & documentLink.Name + Environment.NewLine & "Text:  " + documentLink.Text + Environment.NewLine & "ID: " + documentLink.ID.ToString() + Environment.NewLine + Environment.NewLine
    Next

textBox1.Text = "<<< DocumentLinkss Collection Test >>>" & Environment.NewLine & "The DocumentLinkss Collection Count Property in textControl1 is: " + textControl1.DocumentLinks.Count.ToString()
End If