Remove Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Removes a field of the type ApplicationField from a TX Text Control document.
Syntax
Remove(ApplicationField)
Removes a field of the type ApplicationField including its visible text from a TX Text Control document.
public bool Remove(ApplicationField applicationField);Public Function Remove(applicationField As ApplicationField) As Boolean| Parameter | Description |
|---|---|
| applicationField | Specifies the field to remove. |
Remove(ApplicationField, bool)
Removes a field of the type ApplicationField from a TX Text Control document. The visible text is deleted depending on the keepText parameter.
public bool Remove(ApplicationField applicationField, bool keepText);Public Function Remove(applicationField As ApplicationField, keepText As Boolean) As Boolean| Parameter | Description |
|---|---|
| applicationField | Specifies the field to remove. |
| keepText | If this parameter is set to true, the field is removed without deleting its visible text. Otherwise, the field's text is also deleted. |
Return Value
The return value is true, if the field could be removed. Otherwise, it is false.
Examples
The following example removes a merge field while keeping its current result text in the document.
textControl.Text = "Dear ,";
textControl.InputPosition = new InputPosition(5);
ApplicationFieldCollection fields = textControl.ApplicationFields;
ApplicationField customerField = new(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" }) { ID = 100 };
fields.Add(customerField);
fields.Remove(customerField, true);textControl.Text = "Dear ,"
textControl.InputPosition = New InputPosition(5)
Dim fields As ApplicationFieldCollection = textControl.ApplicationFields
Dim customerField As New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" }) With { .ID = 100 }
fields.Add(customerField)
fields.Remove(customerField, True)