Adds a ColumnHeader object to a ColumnHeaders collection in a ListView control.
Syntax
object.Add(index, key, text, width, alignment, icon)
The Add method syntax has these parts:
Part | Description |
object | Required. An object expression that evaluates to a ColumnHeaders collection. |
index | Optional. An integer that uniquely identifies a member of an object collection. |
key | Optional. A unique string expression that can be used to access a member of the collection. |
text | Optional. A string that appears in the ColumnHeader object. |
width | Optional. A numeric expression specifying the width of the object using the scale units of the control's container. |
alignment | Optional. An integer that determines the alignment of text in the ColumnHeader object. For settings, choose the Alignment property from the See Also list. |
icon | Optional. The key or index of an image in the Smallicons ImageList. |
Remarks
The Add method returns a reference to the newly inserted ColumnHeader object.
Use the index argument to insert a column header in a specific position in the ColumnHeaders collection.
When the members of a ColumnHeaders collection can change dynamically, you may want to reference them using the Key property, because the Index property for any ColumnHeader object may be changing.