ListView.CheckedListViewItemCollection.IndexOf Method (ListViewItem)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com 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
)

Parameters

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
Show: