Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ListViewItem.ListViewSubItemCollection Class

Represents a collection of ListViewItem.ListViewSubItem objects stored in a ListViewItem.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public class ListViewSubItemCollection : IList, ICollection, IEnumerable
public class ListViewSubItemCollection implements IList, ICollection, 
	IEnumerable
public class ListViewSubItemCollection implements IList, ICollection, 
	IEnumerable
Not applicable.

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.

System.Object
  System.Windows.Forms.ListViewItem.ListViewSubItemCollection
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.