Dela via


How to: Add and Remove Items with the Windows Forms ListView Control Using the Designer

The process of adding an item to a Windows Forms ListView control consists primarily of specifying the item and assigning properties to it. Adding or removing list items can be done at any time.

The following procedure requires a Windows Application project with a form containing a ListView control. For information about setting up such a project, see How to: Create a New Windows Forms Application Project and How to: Add Controls to Windows Forms.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.

To add or remove items using the designer

  1. Select the ListView control.

  2. In the Properties window, click the Ellipsis (VisualStudioEllipsesButton screenshot) button next to the Items property.

    The ListViewItem Collection Editor appears.

  3. To add an item, click the Add button. You can then set properties of the new item, such as the Text and ImageIndex properties.

  4. To remove an item, select it and click the Remove button.

See Also

Tasks

How to: Add Columns to the Windows Forms ListView Control

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

How to: Display Icons for the Windows Forms ListView Control

How to: Add Custom Information to a TreeView or ListView Control (Windows Forms)

How to: Group Items in a Windows Forms ListView Control

Reference

ListView Control Overview (Windows Forms)