title | description | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
---|---|---|---|---|---|---|---|---|---|---|
Add Columns to ListView Control |
Learn how to add columns to the Windows Forms ListView control to display several types of information about each list item. |
03/30/2017 |
|
|
79174274-12ee-4a5d-80db-6ec02976d010 |
In the Details view, the xref:System.Windows.Forms.ListView control can display multiple columns for each list item. You can use the columns to display to the user several types of information about each list item. For example, a list of files could display the file name, file type, size, and date the file was last modified. For information about populating the columns after they are created, see How to: Display Subitems in Columns with the Windows Forms ListView Control.
-
Set the control's xref:System.Windows.Forms.ListView.View%2A property to xref:System.Windows.Forms.View.Details.
-
Use the xref:System.Windows.Forms.ListView.ColumnHeaderCollection.Add%2A method of the list view's xref:System.Windows.Forms.ListView.Columns%2A property.
[!code-csharpSystem.Windows.Forms.ListViewLegacyTopics#31] [!code-vbSystem.Windows.Forms.ListViewLegacyTopics#31]
- xref:System.Windows.Forms.ListView
- ListView Control
- ListView Control Overview