# SelectionFormField.SelectedIndex Property

> 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.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > SelectionFormField.SelectedIndex Property
- **537 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selectionformfield/selectedindex-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selectionformfield/selectedindex-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selectionformfield/selectedindex-property/llms-full.txt

---

### 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

```csharp
public int SelectedIndex { get; set; }
```

```vbnet
Public Property SelectedIndex As Integer
```

### Examples

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

```csharp
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}");
```

```vbnet
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}")
```

---

## Nearby

- **Previous:** [SelectionFormField.Items Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selectionformfield/items-property/llms-full.txt)
- **Next:** [SelectionFormFieldEventArgs Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selectionformfieldeventargs/llms-full.txt)
