Assembly: System.Windows.Forms (in system.windows.forms.dll)
A ListViewItem.ListViewSubItemCollection stores ListViewItem.ListViewSubItem objects that represent subitems of a parent ListViewItem in the ListView control. Subitems are only displayed in a ListView control when columns are specified in the Columns property of the ListView control and when the View property of the ListView control is set to Details. The order of subitems in the ListViewItem.ListViewSubItemCollection determines the columns the subitems are displayed in the ListView control.
There are a number of ways to add subitems to the collection. The Add method adds a single ListViewItem.ListViewSubItem to the collection. To add a number of subitems to the collection, you create an array of ListViewItem.ListViewSubItem objects and pass it to the AddRange method. If you want to insert a subitem at a specific location in the collection, you can use the Insert method. To remove subitems, you can use either the Remove method or the RemoveAt method if you know where the subitem is located in the collection. The Clear method enables you to remove all subitems from the collection instead of using the Remove method to remove a single subitem at a time.
In addition to methods and properties for adding and removing subitems, the ListViewItem.ListViewSubItemCollection also provides methods to find subitems in the collection. The Contains method enables you to determine whether a ListViewItem.ListViewSubItem is a member of the collection. Once you know that the subitem is located in the collection, you can use the IndexOf method to determine where the subitem is located in the collection.
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 EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.