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.

For a list of all members of this type, see ListViewItem.ListViewSubItemCollection Members.

System.Object
   System.Windows.Forms.ListViewItem.ListViewSubItemCollection

[Visual Basic]
Public Class ListViewItem.ListViewSubItemCollection
   Implements IList, ICollection, IEnumerable
[C#]
public class ListViewItem.ListViewSubItemCollection : IList,
   ICollection, IEnumerable
[C++]
public __gc class ListViewItem.ListViewSubItemCollection : public
   IList, ICollection, IEnumerable
[JScript]
public class ListViewItem.ListViewSubItemCollection 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.

Remarks

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 View.Details. The order of subitems in the ListViewItem.ListViewSubItemCollection determines the columns the subitems are displayed in 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.

Requirements

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, .NET Compact Framework

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

See Also

ListViewItem.ListViewSubItemCollection Members | System.Windows.Forms Namespace | ListViewItem | ListViewItem.ListViewSubItem | ListView

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.