Export (0) Print
Expand All

ListViewGroupCollection.Add Method (ListViewGroup)

Adds the specified ListViewGroup to the collection.

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

public int Add(
	ListViewGroup group


Type: System.Windows.Forms.ListViewGroup

The ListViewGroup to add to the collection.

Return Value

Type: System.Int32
The index of the group within the collection, or -1 if the group is already present in the collection.


group contains at least one ListViewItem that belongs to a ListView control other than the one that owns this ListViewGroupCollection.

Use this method to add an existing ListViewGroup to the collection. You cannot add a ListViewGroup to the collection more than once. When you call the Add method using a ListViewGroup that is already in the collection, the addition fails and -1 is returned.

To add multiple groups to the collection, use the AddRange method.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft