TX Text Control .NET for Windows Forms

GetItem Method

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

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();

GetItem(int)

Gets the text field with the specified id, previously set with the ID property.

public TextField GetItem(int id);
ParameterDescription
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();