<div class="meta" robots="noindex">

</div>

# ListBox.ListIndex

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `DesktopListBox.SelectedRowIndex<desktoplistbox.selectedrowindex>` as a replacement.

</div>

## Description

The selected item number. The index is zero-based.

## Notes

If no item is selected, <span class="title-ref">ListIndex</span> returns -1. If the ListBox is in multiple-row selection mode, then the number of the lowest selected row is returned. For example, if rows 1, 3, and 4 are selected, <span class="title-ref">ListIndex</span> returns 1.

You can put the ListBox into multiple-row selection mode by changing the `RowSelectionType<listbox.rowselectiontype>` property.

## Sample code

The following code in the `Change<listbox.change>` event handler displays the text in the first column of the selected row:

``` xojo
If Me.ListIndex >= 0 Then
  MsgBox(Me.Cell(Me.ListIndex, 0))
End If
```

## Compatibility

All projects types on all supported operating systems.
