ListViewGroupCollection.Add Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a ListViewGroup to the collection.
Overloads
Add(ListViewGroup) |
Adds the specified ListViewGroup to the collection. |
Add(String, String) |
Adds a new ListViewGroup to the collection using the specified values to initialize the Name and Header properties. |
Add(ListViewGroup)
Adds the specified ListViewGroup to the collection.
public:
int Add(System::Windows::Forms::ListViewGroup ^ group);
public int Add (System.Windows.Forms.ListViewGroup group);
member this.Add : System.Windows.Forms.ListViewGroup -> int
Public Function Add (group As ListViewGroup) As Integer
Parameters
- group
- ListViewGroup
The ListViewGroup to add to the collection.
Returns
The index of the group within the collection, or -1 if the group is already present in the collection.
Exceptions
group
contains at least one ListViewItem that belongs to a ListView control other than the one that owns this ListViewGroupCollection.
The ListView that this collection is assigned to is in virtual mode.
Remarks
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.
See also
Applies to
Add(String, String)
Adds a new ListViewGroup to the collection using the specified values to initialize the Name and Header properties.
public:
System::Windows::Forms::ListViewGroup ^ Add(System::String ^ key, System::String ^ headerText);
public System.Windows.Forms.ListViewGroup Add (string key, string headerText);
public System.Windows.Forms.ListViewGroup Add (string? key, string? headerText);
member this.Add : string * string -> System.Windows.Forms.ListViewGroup
Public Function Add (key As String, headerText As String) As ListViewGroup
Parameters
Returns
The new ListViewGroup.
Exceptions
The ListView that this collection is assigned to is in virtual mode.