Remove Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Removes a hypertext link from a Text Control document.
Syntax
Remove(HypertextLink)
Removes a hypertext link including its visible text from a Text Control document.
public bool Remove(HypertextLink hypertextLink);Public Function Remove(hypertextLink As HypertextLink) As Boolean| Parameter | Description |
|---|---|
| hypertextLink | Specifies the hypertext link to remove. |
Remove(HypertextLink, bool)
Removes a hypertext link from a Text Control document. The visible text is deleted depending on the keepText parameter.
public bool Remove(HypertextLink hypertextLink, bool keepText);Public Function Remove(hypertextLink As HypertextLink, keepText As Boolean) As Boolean| Parameter | Description |
|---|---|
| hypertextLink | Specifies the hypertext link to remove. |
| keepText | If this parameter is set to true, the hypertext link is removed without deleting its text. Otherwise, the link's text is also deleted. |
Return Value
The return value is true, if the hypertext link could be removed. Otherwise it is false.
Examples
The following example works with hypertext links in the current document by using HypertextLinkCollection.Remove.
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)
{
HypertextLink hypertextLink = hypertextLinkCollection[1];
if (hypertextLinkCollection.Remove(hypertextLink))
{
Console.WriteLine("The item was removed.");
}
}textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim hypertextLinkCollection As HypertextLinkCollection = textControl.HypertextLinks
hypertextLinkCollection.Add(New HypertextLink("Documentation", "https://docs.textcontrol.com/") With { .ID = 100 })
If hypertextLinkCollection.Count > 0 Then
Dim hypertextLink As HypertextLink = hypertextLinkCollection.Item(1)
If hypertextLinkCollection.Remove(hypertextLink) Then
Console.WriteLine("The item was removed.")
End If
End If