ListViewGroupCollection::Add Method (ListViewGroup^)
.NET Framework (current version)
Adds the specified ListViewGroup to the collection.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- group
-
Type:
System.Windows.Forms::ListViewGroup^
The ListViewGroup to add to the collection.
Return Value
Type: System::Int32The index of the group within the collection, or -1 if the group is already present in the collection.
| Exception | Condition |
|---|---|
| ArgumentException | 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
Available since 2.0
Available since 2.0
Show: