GetItem Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets a particular field of the type ApplicationField from the collection.
Syntax
GetItem()
Gets the field at the current input position or null, if there is no such field at the current input position.
public ApplicationField GetItem();Public Function GetItem() As ApplicationFieldGetItem(int)
Gets the field with the specified id, previously set with the ID property.
public ApplicationField GetItem(int id);Public Function GetItem(id As Integer) As ApplicationField| Parameter | Description |
|---|---|
| id | Specifies the field's identifier set with the ID property. The method returns null, if a field of the type ApplicationField with the specified identifier does not exist. |
Examples
The following example retrieves a merge field by its stable ID and updates its displayed text.
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);
ApplicationField field = fields.GetItem(100);
if (field != null)
{
field.Text = "Contoso Ltd.";
}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)
Dim field As ApplicationField = fields.GetItem(100)
If field IsNot Nothing Then
field.Text = "Contoso Ltd."
End If