TX Text Control .NET for Windows Forms

Remove Method

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

Description

Removes an editable region from the collection. The region's text is not removed.

Syntax

public bool Remove(EditableRegion editableRegion, bool selectedPart);

Parameters

ParameterDescription
editableRegion

Specifies the editable region to remove.

selectedPart

When this parameter is true, only the selected part of the editable region is removed. If the selection is in the middle od the region, it is split into two parts with the same parameters.

Return Value

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

Examples

The following example works with editable regions in the current document by using EditableRegionCollection.Remove.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
EditableRegionCollection editableRegionCollection = textControl.EditableRegions;
editableRegionCollection.Add(new EditableRegion("ReviewTeam", 100));

if (editableRegionCollection.Count > 0)
{
    EditableRegion editableRegion = editableRegionCollection[1];
    if (editableRegionCollection.Remove(editableRegion, true))
    {
        Console.WriteLine("The item was removed.");
    }
}