Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Display Subitems in Columns with the Windows Forms ListView Control

The Windows Forms ListView control can display additional text, or subitems, for each item in the Details view. The first column displays the item text, for example an employee number. The second, third, and subsequent columns display the first, second, and subsequent associated subitems.

To add subitems to a list item

  1. Add any columns needed. Because the first column will display the item's Text property, you need one more column than there are subitems. For more information on adding columns, see How to: Add Columns to the Windows Forms ListView Control.

  2. Call the Add method of the collection returned by the SubItems property of an item. The code example below sets the employee name and department for a list item.

            // Adds two subitems to the first list item.
            listView1.Items[0].SubItems.Add("John Smith");
© 2015 Microsoft