ListView.Clear Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Removes all items and columns from the control.

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

member Clear : unit -> unit

You can use this method to remove all items and columns from the ListView control without having to call the individual Clear methods from the ListView.ColumnHeaderCollection and ListView.ListViewItemCollection classes.


The Clear method does not clear Groups specified for the ListView control. To clear Groups call ListViewGroupCollection.Clear.

The following code example demonstrates the use of Clear and ListViewItem.Selected members. To run this example, paste the following code into a form that contains a ListView named ListView1 and a button, located toward the bottom of the form, named Button1. Call the InitializeListView method from the form's constructor or Load method.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top