ListView.CheckedListViewItemCollection Class
Assembly: System.Windows.Forms (in system.windows.forms.dll)
A ListView.CheckedListViewItemCollection stores 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 items stored in the ListView.CheckedListViewItemCollection are items contained in the ListView.ListViewItemCollection. The ListView.ListViewItemCollection class stores all items displayed in the ListView control.
The following table shows an example of how the ListView.ListViewItemCollection stores the items of the ListView as well as their selection 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.CheckedListViewItemCollection would appear.
| Index | Checked item in ListViewItemCollection |
|---|---|
| 0 | Item2 |
| 1 | Item4 |
| 2 | Item5 |
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 item from the ListView.ListViewItemCollection class is a member of the ListView.CheckedListViewItemCollection. Once you know that the item is in the collection, you can use the IndexOf method to determine the position of the item in the ListView.CheckedListViewItemCollection.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.