Visual Basic: MSFlexGrid/MSHFlexGrid Controls

Visual Studio 6.0

ColWidth Property (MSHFlexGrid)

See Also    Example    Applies To

Returns or sets the width of the column in the specified band, in logical twips. This property is not available at design time.

Note   When using the MSFlexGrid, this property returns or sets the width of the specified column, in twips. Also, the ColWidth syntax, below, cannot be used in an MSFlexGrid due to the limitations of this control. If you are using MSFlexGrid, use the syntax: object.ColWidth(number) [= value]


object.ColWidth(index, number) [= value]

The ColWidth property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
index A Long value that specifies which column's width to change.

Note   This is not applicable to the MSFlexGrid.

number A Long value that specifies the band that contains the column. Optional.

Note   In the MSFlexGrid, this is a numeric expression that specifies the column.

value A numeric expression that specifies the width of the specified column, in twips.


You can use this property to set the width of any column at run time. For instructions on setting column widths at design time, see the FormatString property.

You can set ColWidth to zero to create invisible columns, or to 1 to reset the column width to its default value, which depends on the size of the current font.

When number is not specified, it defaults to 0. Hence, when the MSHFlexGrid is not bound to a hierarchical Recordset, using 0 and not specifying number both have the same result. Note that number is an optional parameter for backward compatibility with the MSFlexGrid.