This documentation is archived and is not being maintained.

ListView.SelectedIndexCollection.Contains Method

Determines whether the specified index is located in the collection.

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


The index to locate in the collection.

Return Value

true if the specified index from the ListView.ListViewItemCollection for the ListView is an item in the collection; otherwise, false.


The Contains method enables you to determine whether an index position from the ListView.ListViewItemCollection is one of the selected indexes stored in ListView.SelectedIndexCollection. Once you know that an item is in the selected index collection, you can use the IndexOf method to determine the position of the index in the ListView.SelectedIndexCollection.


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

See Also

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