ListBox.SelectedIndexCollection.Contains Method (Int32)


Determines whether the specified index is located within the collection.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public bool Contains(
	int selectedIndex


Type: System.Int32

The index to locate in the collection.

Return Value

Type: System.Boolean

true if the specified index from the ListBox.ObjectCollection for the ListBox is an item in this collection; otherwise, false.

The Contains method enables you to determine whether an index position from the ListBox.ObjectCollection class is a member of the selected indexes stored in the ListBox.SelectedIndexCollection. You can use this to determine whether a specific item in a multiple-selection ListBox is selected.

.NET Framework
Available since 1.1
Return to top