Add (ColumnHeaders)

This method adds a ColumnHeader object to a ColumnHeaders collection in a ListView control.

Syntax

columnheaders.Add([index], [key], text, [width], [alignment])

Parameters

columnheaders
Name of a ColumnHeaders collection.
index
Optional. Integer that uniquely identifies a member of the ColumnHeaders collection.
key
Optional. Unique string expression that can be used to access the new ColumnHeader.
text
String that appears in the ColumnHeader object.
width
Optional. Numeric expression that specifies the width of the ColumnHeader.
alignment
Optional. Integer that determines the alignment of text in the ColumnHeader object. For settings, see the Alignment property.

Return Value

Reference to the new ColumnHeader object.

Remarks

Use the index parameter to insert a column header in a specific position in the ColumnHeaders collection. If you do not supply a value for index, or the value for index is too large, the ColumnHeader object is added with an Index equal to the number of ColumnHeader objects in the collection plus one.

Use the Key property to reference a member of the ColumnHeaders collection if you expect the value of an object's Index property to change.