This documentation is archived and is not being maintained.

ListView.CheckedListViewItemCollection.IndexOf Method

Returns the index within the collection of the specified item.

[Visual Basic]
Public Function IndexOf( _
   ByVal item As ListViewItem _
) As Integer
public int IndexOf(
 ListViewItem item
public: int IndexOf(
 ListViewItem* item
public function IndexOf(
   item : ListViewItem
) : int;


A ListViewItem representing the item to locate in the collection.

Return Value

The zero-based index of the item in the collection; otherwise, -1.


Once you know that an item is located within the collection (using the Contains method), you can use the IndexOf method to determine where a specific item within the ListView.ListViewItemCollection for the ListView is stored within the ListView.CheckedListViewItemCollection.


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

ListView.CheckedListViewItemCollection Class | ListView.CheckedListViewItemCollection Members | System.Windows.Forms Namespace | Contains