This documentation is archived and is not being maintained.

ListBox.SelectedIndexCollection.Contains Method

Determines whether the specified index is located within the collection.

[Visual Basic]
Public Function Contains( _
   ByVal selectedIndex As Integer _
) As Boolean
[C#]
public bool Contains(
 int selectedIndex
);
[C++]
public: bool Contains(
 int selectedIndex
);
[JScript]
public function Contains(
   selectedIndex : int
) : Boolean;

Parameters

selectedIndex
The index to locate in the collection.

Return Value

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

Remarks

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.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ListBox.SelectedIndexCollection Class | ListBox.SelectedIndexCollection Members | System.Windows.Forms Namespace | IndexOf

Show: