Share via


ColWidth Property (ModHFGrid)

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

Syntax

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

The ColWidth property syntax has these parts:

Part Description
object An object expression that evaluates to the ModHFGrid Control object.
index A Long value that specifies which column's width to change.
number Optional. A Long value that specifies the band that contains the column.
value A numeric expression that specifies the width of the specified column in twips.

Remarks

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 0 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. Therefore, when the ModHFGrid is not bound to a hierarchical Recordset, using 0 and not specifying number both have the same result.

Example

The following code sets the value of the size of the first column. If the AllowUserResizing property is True, the value changes as the user resizes Column 1.

Sub Form1_Load()
   ModHFGrid1.AllowUserResizing = True
End Sub

Sub ModHFGrid1_MouseUp (Button As Integer, Shift As _
Integer, X As Single, Y As Single)
   ModHFGrid1.Text = ModHFGrid1.ColWidth(0)
End Sub

See Also

AllowUserResizing Property (ModHFGrid) | FormatString Property (ModHFGrid) | ModHFGrid Control