TX Text Control .NET for Windows Forms

Add Method

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

Description

Inserts the specified form field at the current input position.

Syntax

public bool Add(FormField formField);

Parameters

ParameterDescription
formField

Specifies the form field to add.

Return Value

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

Examples

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

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
FormFieldCollection formFieldCollection = textControl.FormFields;

if (!formFieldCollection.Add(new TXTextControl.CheckFormField(true)))
{
    throw new InvalidOperationException("The item could not be inserted.");
}