TX Text Control .NET for Windows Forms

Remove Method

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

Description

Removes the specified target from a Text Control document.

Syntax

public bool Remove(DocumentTarget documentTarget);

Parameters

ParameterDescription
documentTarget

Specifies the document target to remove.

Return Value

The return value is true, if the document target could be removed. Otherwise it is false.

Examples

The following example works with document targets in the current document by using DocumentTargetCollection.Remove.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentTargetCollection documentTargetCollection = textControl.DocumentTargets;
documentTargetCollection.Add(new DocumentTarget("CustomerDetails") { ID = 100 });

if (documentTargetCollection.Count > 0)
{
    DocumentTarget documentTarget = documentTargetCollection[1];
    if (documentTargetCollection.Remove(documentTarget))
    {
        Console.WriteLine("The item was removed.");
    }
}