Share via


ListIndex Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

                          

Identifies the currently selected item in a ListBox or ComboBox.

Syntax

object.ListIndex [= Variant]

The ListIndex property syntax has these parts:

Part Description
object Required. A valid object.
Variant Optional. The currently selected item in the control.

Remarks

The ListIndex property contains an index of the selected row in a list. Values of ListIndex range from 1 to one less than the total number of rows in a list (that is, ListCount 1). When no rows are selected, ListIndex returns 1. When the user selects a row in a ListBox or ComboBox, the system sets the ListIndex value. The ListIndex value of the first row in a list is 0, the value of the second row is 1, and so on.

Note If you use the MultiSelect property to create a ListBox that allows multiple selections, the Selected property of the ListBox (rather than the ListIndex property) identifies the selected rows. The Selected property is an with the same number of values as the number of rows in the ListBox. For each row in the list box, Selected is True if the row is selected and False if it is not. In a ListBox that allows multiple selections, ListIndex returns the index of the row that has , regardless of whether that row is currently selected.

The ListIndex value is also available by setting the BoundColumn property to 0 for a combo box or list box. If BoundColumn is 0, the underlying to which the combo box or list box is contains the same list index value as ListIndex.