GetItem Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets a particular text field from the collection.
Syntax
GetItem()
Gets the text field at the current text input position or null, if there is no text field at the current text input position.
public TextField GetItem();Public Function GetItem() As TextFieldGetItem(int)
Gets the text field with the specified id, previously set with the ID property.
public TextField GetItem(int id);Public Function GetItem(id As Integer) As TextField| Parameter | Description |
|---|---|
| id | Specifies the text field's identifier set with the ID property. The method returns null if a text field with the specified identifier does not exist. |
Examples
The following example works with text fields in the current document by using TextFieldCollection.get_Item.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TextFieldCollection textFieldCollection = textControl.TextFields;
textFieldCollection.Add(new ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" }) { ID = 100 });
TextField result = textFieldCollection.GetItem(100);
result?.ScrollTo();textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim textFieldCollection As TextFieldCollection = textControl.TextFields
textFieldCollection.Add(New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" }) With { .ID = 100 })
Dim result As TextField = textFieldCollection.GetItem(100)
If result IsNot Nothing Then result.ScrollTo()