ListViewGroupCollection.Add ListViewGroupCollection.Add ListViewGroupCollection.Add ListViewGroupCollection.Add Method

Definition

Adds a ListViewGroup to the collection.

Overloads

Add(ListViewGroup) Add(ListViewGroup) Add(ListViewGroup) Add(ListViewGroup)

Adds the specified ListViewGroup to the collection.

Add(String, String) Add(String, String) Add(String, String) Add(String, String)

Adds a new ListViewGroup to the collection using the specified values to initialize the Name and Header properties

Add(ListViewGroup) Add(ListViewGroup) Add(ListViewGroup) 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

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.

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

Add(String, String) Add(String, String) Add(String, String) 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);
member this.Add : string * string -> System.Windows.Forms.ListViewGroup
Public Function Add (key As String, headerText As String) As ListViewGroup

Parameters

key
String String String String

The initial value of the Name property for the new group.

headerText
String String String String

The initial value of the Header property for the new group.

Returns

Applies to