SelectedIndex Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
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; }Public Property SelectedIndex As IntegerExamples
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}");Dim selectionFormField As New SelectionFormField(New String() { "Germany", "United Kingdom", "United States" }, 0) With { .Name = "Country" }
textControl.FormFields.Add(selectionFormField)
selectionFormField.SelectedIndex = 1
Console.WriteLine($"Selected Index used by Selection Form Field: {selectionFormField.SelectedIndex}")