Export (0) Print
Expand All

ListViewItem.ListViewSubItemCollection Class

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

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

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

'Declaration
Public Class ListViewSubItemCollection _
	Implements IList, ICollection, IEnumerable

The ListViewItem.ListViewSubItemCollection type exposes the following members.

  NameDescription
Public methodListViewItem.ListViewSubItemCollectionInitializes a new instance of the ListViewItem.ListViewSubItemCollection class.
Top

  NameDescription
Public propertyCountGets the number of subitems in the collection.
Public propertyIsReadOnlyGets a value indicating whether the collection is read-only.
Public propertyItem(Int32)Gets or sets the subitem at the specified index within the collection.
Public propertyItem(String)Gets an item with the specified key from the collection.
Top

  NameDescription
Public methodAdd(ListViewItem.ListViewSubItem)Adds an existing ListViewItem.ListViewSubItem to the collection.
Public methodAdd(String)Adds a subitem to the collection with specified text.
Public methodAdd(String, Color, Color, Font)Adds a subitem to the collection with specified text, foreground color, background color, and font settings.
Public methodAddRange(ListViewItem.ListViewSubItem())Adds an array of ListViewItem.ListViewSubItem objects to the collection.
Public methodAddRange(String())Creates new subitems based on an array and adds them to the collection.
Public methodAddRange(String(), Color, Color, Font)Creates new subitems based on an array and adds them to the collection with specified foreground color, background color, and font.
Public methodClearRemoves all subitems and the parent ListViewItem from the collection.
Public methodContainsDetermines whether the specified subitem is located in the collection.
Public methodContainsKeyDetermines if the collection contains an item with the specified key.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnumeratorReturns an enumerator to use to iterate through the subitem collection.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexOfReturns the index within the collection of the specified subitem.
Public methodIndexOfKeyReturns the index of the first occurrence of an item with the specified key within the collection.
Public methodInsertInserts a subitem into the collection at the specified index.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveRemoves a specified item from the collection.
Public methodRemoveAtRemoves the subitem at the specified index within the collection.
Public methodRemoveByKeyRemoves an item with the specified key from the collection.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast(Of TResult)Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType(Of TResult)Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

  NameDescription
Explicit interface implemetationPrivate methodICollection.CopyToInfrastructure. Copies the item and collection of subitems into an array.
Explicit interface implemetationPrivate propertyICollection.IsSynchronizedInfrastructure. Gets a value indicating whether access to the collection is synchronized (thread safe).
Explicit interface implemetationPrivate propertyICollection.SyncRootInfrastructure. Gets an object that can be used to synchronize access to the collection.
Explicit interface implemetationPrivate methodIList.AddInfrastructure. Adds an existing ListViewItem.ListViewSubItem to the collection.
Explicit interface implemetationPrivate methodIList.ContainsInfrastructure. Determines whether the specified subitem is located in the collection.
Explicit interface implemetationPrivate methodIList.IndexOfInfrastructure. Returns the index within the collection of the specified subitem.
Explicit interface implemetationPrivate methodIList.InsertInfrastructure. Inserts a subitem into the collection at the specified index.
Explicit interface implemetationPrivate propertyIList.IsFixedSizeInfrastructure. Gets a value indicating whether the collection has a fixed size.
Explicit interface implemetationPrivate propertyIList.ItemInfrastructure. Gets or sets the ListViewItem.ListViewSubItem at the specified index within the collection.
Explicit interface implemetationPrivate methodIList.RemoveRemoves a specified item from the collection.
Top

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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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

Community Additions

ADD
Show:
© 2014 Microsoft