TX Text Control .NET for Windows Forms

Remove Method

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

Description

Removes a CommentedText from the collection. The method removes the saved position values and the comment string. The text, which is commented, is not removed from the document.

Syntax

public bool Remove(CommentedText commentedText);

Parameters

ParameterDescription
commentedText

Specifies the CommentedText to remove.

Return Value

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

Examples

The following example works with comments in the current document by using CommentCollection.Remove.

CommentCollection commentCollection = textControl.Comments;
textControl.Text = "Payment is due within 30 days.";
textControl.Select(0, textControl.Text.Length);
commentCollection.Add(new CommentedText("Verify the payment term."));

if (commentCollection.Count > 0)
{
    CommentedText commentedText = commentCollection[1];
    if (commentCollection.Remove(commentedText))
    {
        Console.WriteLine("The item was removed.");
    }
}