This documentation is archived and is not being maintained.

ListView.CheckedIndexCollection Class

Represents the collection containing the indexes to the checked items in a list view control.

For a list of all members of this type, see ListView.CheckedIndexCollection Members.


[Visual Basic]
Public Class ListView.CheckedIndexCollection
   Implements IList, ICollection, IEnumerable
public class ListView.CheckedIndexCollection : IList, ICollection,
public __gc class ListView.CheckedIndexCollection : public IList,
   ICollection, IEnumerable
public class ListView.CheckedIndexCollection implements IList,
   ICollection, IEnumerable

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


A ListView.CheckedIndexCollection stores the indexes to the checked items in a ListView control. Items can only be checked if the CheckBoxes property of the ListView control is set to true. The indexes stored in the ListView.CheckedIndexCollection are index positions within the ListView.ListViewItemCollection. The ListView.ListViewItemCollection stores all items displayed in the ListView control.

The following table is an example of how the ListView.ListViewItemCollection stores the items of the ListView as well as their checked states in an example ListView control.

Index Item Checked state in the ListView
0 Item1 Unchecked
1 Item2 Checked
2 Item3 Unchecked
3 Item4 Checked
4 Item5 Checked

Based on the ListView.ListViewItemCollection example in the previous table, the following table demonstrates how the ListView.CheckedIndexCollection would appear.

Index Index of checked item in ListViewItemCollection
0 1
1 3
2 4

You can use the properties and methods of this class to perform a variety of tasks with the collection. The Contains method enables you to determine whether an index position from the ListView.ListViewItemCollection is one of the indexes stored in the ListView.CheckedIndexCollection. Once you know that the item is in the collection, you can use the IndexOf method to determine the position of the index in the ListView.CheckedIndexCollection.


Namespace: System.Windows.Forms

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

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

See Also

ListView.CheckedIndexCollection Members | System.Windows.Forms Namespace | ListView.ListViewItemCollection