Gets a collection that contains the zero-based indexes of all currently selected items in the ListBox.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
[<BrowsableAttribute(false)>] member SelectedIndices : ListBox.SelectedIndexCollection with get
Property ValueType: System.Windows.Forms.ListBox.SelectedIndexCollection
For a multiple-selection ListBox, this property returns a collection containing the indexes to all items that are selected in the ListBox. For a single-selection ListBox, this property returns a collection containing a single element containing the index of the only selected item in the ListBox. For more information about how to manipulate the items of the collection, see ListBox.SelectedIndexCollection.
The ListBox class provides a number of ways to reference selected items. Instead of using the property to obtain the index position of the currently selected item in a single-selection ListBox, you can use the SelectedIndex property. If you want to obtain the item that is currently selected in the ListBox, instead of the index position of the item, use the SelectedItem property. In addition, you can use the SelectedItems property if you want to obtain all the selected items in a multiple-selection ListBox.
The following code example demonstrates how to use the FindString method to search for all instances of the search text in the items of the ListBox. The example uses the version of the FindString method that enables you to specify a starting search index from which to do a continual search of all items in the ListBox. The example also demonstrates how to determine when the FindString method begins searching from the top of the list after it reaches the bottom of the list of items to prevent a recursive search. Once items are found in the ListBox, they are selected using the SetSelected method.
Available since 1.1