Version

SelectedIndex Property

Gets or sets the selected index. Only valid when in edit mode.
Syntax
'Declaration
 
Public Property SelectedIndex As Integer
public int SelectedIndex {get; set;}
Remarks

SelectedIndex returns the index of the currently selected item. If no item is selected then returns -1. Likewise you can set this property to -1 to clear selected item. You can set SelectedIndex to a different value to change the item that's currently selected. This is always synchronized with the SelectedItem property. Also note that the Value property will reflect the updated selected item.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also