A ColumnHeaders object is a collection of ColumnHeader objects.
A ColumnHeader object represents an individual column header in the ColumnHeaders collection of a ListView control.
ListView.ColumnHeaders
ListView.ColumnHeaders[.Item](index)]
index:Variant
The syntax above refers to the collection and to individual elements in the collection, respectively, according to the standard collection syntax.
The ListView.ColumnHeaders property returns a reference to the ColumnHeaders object, a collection of ColumnHeader objects.
ListView.ColumnHeaders.Item(index) returns a reference to the ColumnHeader with the given index (integer or string). Since Item is the default property it can be left out.
For each ColumnHeader object, you can add text, and set properties to change its alignment and width. You can manipulate ColumnHeader objects using standard collection methods (for example, the Add and Remove methods). Each element in the collection can be accessed by its index, the value of the Index property, or by a unique key, the value of the Key property.
The ColumnHeaders properties and methods:
Add | Clear | Count | Item | Remove
The ColumnHeader properties and methods:
Alignment | Index | Key | Left | ListViewName | SubItemIndex | Tag | Text | Width
Dim ch As ColumnHeader
Ocx ListView lv1 = "", 10, 10, 400, 200 : .View = 3
Set ch = lv1.ColumnHeaders.Add( , , "Column1") : ch.Width = TextWidth(" Column1 ") * Screen.TwipsPerPixelX
Set ch = lv1.ColumnHeaders.Add( , , "Column2") : ch.Width = TextWidth(" Column2 ") * Screen.TwipsPerPixelX
Set ch = lv1.ColumnHeaders.Add( , , "Column3") : ch.Alignment = 2
Set ch = lv1.ColumnHeaders.Add( , , "Column4") : ch.Alignment = 1
Do : Sleep : Until Me Is Nothing
{Created by Sjouke Hamstra; Last updated: 25/09/2014 by James Gaite}