ListView.Columns Property


Gets the collection of all column headers that appear in the control.

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

member Columns : ListView.ColumnHeaderCollection with get

Property Value

Type: System.Windows.Forms.ListView.ColumnHeaderCollection

A ListView.ColumnHeaderCollection that represents the column headers that appear when the View property is set to Details.

The Columns property returns a collection that contains the ColumnHeader objects that are displayed in the ListView control. ColumnHeader objects define the columns that are displayed in the ListView control when the View property is set to Details. Each column is used to display subitem information for each item in the ListView. For more information about how to manipulate the items in the collection, see ListView.ColumnHeaderCollection.


If your ListView control does not have any column headers specified and you set the View property to Details, the ListView control will not display any items.

The following code example creates a ListView control with three ListViewItem objects specified and three ListViewItem.ListViewSubItem objects specified for each item. The example also creates ColumnHeader objects to display the subitems in details view. Two ImageList objects are also created in the code example to provide images for the ListViewItem objects. These ImageList objects are added to the LargeImageList and SmallImageList properties. The example uses the following properties in creating the ListView control.

This example requires that you have added the code to a Form and call the method created in the example from the constructor or another method on the form. The example also requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.

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

.NET Framework
Available since 1.1
Return to top