Add Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Inserts a new object of the type ApplicationField at the current input position.
Syntax
public bool Add(ApplicationField applicationField);Public Function Add(applicationField As ApplicationField) As BooleanParameters
| Parameter | Description |
|---|---|
| applicationField | Specifies the field to add. |
Return Value
The return value is true, if the field could be added. Otherwise it is false.
Examples
The following example inserts a Word-compatible MERGEFIELD for a customer's name at the current input position.
textControl.Text = "Dear ,";
textControl.InputPosition = new InputPosition(5);
ApplicationField customerField = new(
ApplicationFieldFormat.MSWord,
"MERGEFIELD",
"Customer name",
new[] { "CustomerName" });
if (!textControl.ApplicationFields.Add(customerField))
{
throw new InvalidOperationException("The merge field could not be inserted.");
}textControl.Text = "Dear ,"
textControl.InputPosition = New InputPosition(5)
Dim customerField As New ApplicationField(
ApplicationFieldFormat.MSWord,
"MERGEFIELD",
"Customer name",
New String() { "CustomerName" })
If Not textControl.ApplicationFields.Add(customerField) Then
Throw New InvalidOperationException("The merge field could not be inserted.")
End If