System.Windows.Forms.ListViewGroupCollection.Clear Method

Removes all groups from the collection.

Syntax

public void Clear ()

Remarks

Use this method to remove all the groups from the collection. Note that removing groups from the ListView.Groups collection does not remove items from the System.Windows.Forms.ListView control.

This method is useful to disable the grouping feature. When there are no groups in a System.Windows.Forms.ListView control, the items appear normally. To remove individual groups from the collection, use the ListViewGroupCollection.Remove(ListViewGroup) or ListViewGroupCollection.RemoveAt(int) method.

This method is also useful when you want to provide multiple ways to group the items. To change the grouping, first use the ListViewGroupCollection.Clear method to remove all the groups from the collection, then use the ListViewGroupCollection.AddRange(ListViewGroup[]) method to add a different array of groups.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0