Visual Basic: Windows Controls
ListView Control
See Also Example Properties Methods Events
The ListView control displays items using one of four different views. You can arrange items into columns with or without column headings as well as display accompanying icons and text.
Syntax
ListView
Remarks
With a ListView control, you can organize list entries, called ListItem objects, into one of four different views:
Large (standard) Icons
Small Icons
List
Report
The View property determines which view the control uses to display the items in the list. You can also control whether the labels associated with items in the list wrap to more than one line using the LabelWrap property. In addition, you can manage how items in the list are sorted and how selected items appear.
The ListView control contains ListItem and ColumnHeader objects. A ListItem object defines the various characteristics of items in the ListView control, such as:
A brief description of the item.
Icons that may appear with the item, supplied by an ImageList control.
Additional pieces of text, called subitems, associated with a ListItem object that you can display in Report view.
You can choose to display column headings in the ListView control using the HideColumnHeaders property. They can be added at both design and run time. At design time, you can use the Column Headers tab of the ListView Control Properties dialog box. At run time, use the Add method to add a ColumnHeader object to the ColumnHeaders collection.
Distribution Note The ListView control is part of a group of ActiveX controls that are found in the MSCOMCTL.OCX file. To use the ListView control in your application, you must add the MSCOMCTL.OCX file to the project. When distributing your application, install the MSCOMCTL.OCX file in the user's Microsoft Windows System or System32 directory. For more information on how to add an ActiveX control to a Visual Basic project, see the Visual Basic Programmer's Guide.