Visual Basic: DataGrid Control

Visual Studio 6.0

DefColWidth Property

See Also   Example   Applies To

Returns or sets a value indicating the default column width for all columns in the DataGrid control.


object.DefColWidth [= value]

The DefColWidth property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value An integer based on the scale mode of the control.


If you set the DefColWidth property to 0, the control automatically sizes all columns based on either the width of the column heading or the Size property setting of the underlying field, whichever is larger. For example, to set the default column width of all columns to the width of the first column:

DataGrid1.DefColWidth = DataGrid1.Columns(0).Width