Remove Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Removes a document link from a Text Control document.
Syntax
Remove(DocumentLink)
Removes a document link including its visible text from a Text Control document.
public bool Remove(DocumentLink documentLink);Public Function Remove(documentLink As DocumentLink) As Boolean| Parameter | Description |
|---|---|
| documentLink | Specifies the document link to remove. |
Remove(DocumentLink, bool)
Removes a document link from a Text Control document. The visible text is deleted depending on the keepText parameter.
public bool Remove(DocumentLink documentLink, bool keepText);Public Function Remove(documentLink As DocumentLink, keepText As Boolean) As Boolean| Parameter | Description |
|---|---|
| documentLink | Specifies the document link to remove. |
| keepText | If this parameter is set to true, the document link is removed without deleting its text. Otherwise, the link's text is also deleted. |
Return Value
The return value is true, if the document link could be removed. Otherwise it is false.
Examples
The following example works with document links in the current document by using DocumentLinkCollection.Remove.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentLinkCollection documentLinkCollection = textControl.DocumentLinks;
DocumentTarget target = new("CustomerDetails");
textControl.DocumentTargets.Add(target);
documentLinkCollection.Add(new DocumentLink("View customer details", target) { ID = 100 });
if (documentLinkCollection.Count > 0)
{
DocumentLink documentLink = documentLinkCollection[1];
if (documentLinkCollection.Remove(documentLink))
{
Console.WriteLine("The item was removed.");
}
}textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim documentLinkCollection As DocumentLinkCollection = textControl.DocumentLinks
Dim target As New DocumentTarget("CustomerDetails")
textControl.DocumentTargets.Add(target)
documentLinkCollection.Add(New DocumentLink("View customer details", target) With { .ID = 100 })
If documentLinkCollection.Count > 0 Then
Dim documentLink As DocumentLink = documentLinkCollection.Item(1)
If documentLinkCollection.Remove(documentLink) Then
Console.WriteLine("The item was removed.")
End If
End If