ListBox.GetSelectedIndices Method

Definition

Gets the array of index values for currently selected items in the ListBox control.

C#
public virtual int[] GetSelectedIndices();

Returns

Int32[]

An array of integers, each representing the index of a selected item in the list box.

Remarks

Use the GetSelectedIndices method to identify or access the selected items in the ListBox control. Each element in the returned array represents the index for a selected list item. You can use the index values to access the items in the Items collection.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also