ListView.CheckedListViewItemCollection.IndexOf Method (ListViewItem)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the index within the collection of the specified item.

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

public int IndexOf(
	ListViewItem item


Type: System.Windows.Forms.ListViewItem

A ListViewItem representing the item to locate in the collection.

Return Value

Type: System.Int32

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.

.NET Framework
Available since 1.1
Return to top