ColumnHeader Object, ColumnHeaders Collection

                   

Syntax

listview.ColumnHeaders

listview.ColumnHeaders(index)

The syntax lines above refer to the collection and to individual elements in the collection, respectively, according to the standard collection syntax.

The ColumnHeader object, ColumnHeaders collection syntax has these parts:

Part Description
listview An object expression that evaluates to a ListView control.
index Either an integer or string that uniquely identifies a member of an object collection. An integer would be the value of the Index property; a string would be the value of the Key property.

Remarks

You can view ColumnHeader objects in Report view only.

You can add ColumnHeader objects to a ListView control at both design time and run time.

With a ColumnHeader object, a user can:

There is always one column in the ListView control, which is Column 1. This column contains the actual ListItem objects; not their subitems. The second column (Column 2) contains subitems. Therefore, you always have one more ColumnHeader object than subitems and the ListItem object's SubItems property is a 1-based array of size ColumnHeaders.Count - 1.

The number of ColumnHeader objects determines the number of subitems each ListItem object in the control can have. When you delete a ColumnHeader object, all of the subitems associated with the column are also deleted, and each ListItem object's subitem array shifts to update the indices of the ColumnHeader, causing the remaining column headers' SubItemIndex properties to change.