TX Text Control .NET for Windows Forms

SelectedIndex Property

Property|Introduced in 28.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Gets or sets the index of the selected item of the SelectionFormField. If the property value is -1, no item is selected and the currently selected item is deselected.

Syntax

public int SelectedIndex { get; set; }

Examples

The following example adds a country selector to a fillable form by using SelectionFormField.SelectedIndex.

SelectionFormField selectionFormField = new(new[] { "Germany", "United Kingdom", "United States" }, 0) { Name = "Country" };
textControl.FormFields.Add(selectionFormField);

selectionFormField.SelectedIndex = 1;
Console.WriteLine($"Selected Index used by Selection Form Field: {selectionFormField.SelectedIndex}");