TX Text Control .NET Server

Remove Method

Method|Introduced in 28.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Removes the specified form field from a Text Control document.

Syntax

Remove(FormField)

Removes the specified form field from a Text Control document.

public bool Remove(FormField formField);
ParameterDescription
formField

Specifies the formr field to remove.

Remove(FormField, bool)

public bool Remove(FormField formField, bool keepText);

Return Value

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

Examples

The following example works with form fields in the current document by using FormFieldCollection.Remove.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
FormFieldCollection formFieldCollection = textControl.FormFields;
formFieldCollection.Add(new CheckFormField(false) { Name = "AcceptTerms", ID = 100 });

if (formFieldCollection.Count > 0)
{
    FormField formField = formFieldCollection[1];
    if (formFieldCollection.Remove(formField))
    {
        Console.WriteLine("The item was removed.");
    }
}

Further Reading

  • Create, Pre-Select, Flatten and Extract PDF Form Fields using C# –
  • Form Field Handling in PDF Documents –