property Column.Def(Property as DefColumnEnum) as Variant
Retrieves or sets a value that indicates the default value of given properties for all cells in the same column.

TypeDescription
Property as DefColumnEnum A DefColumnEnum expression that indicates the property being changed.
Variant A Variant value that specifies the newly value.
Use the Def property to specify a common value for given properties for all cells in the column. For instance, you can use the Def property to assign check boxes to all cells in the column, without enumerating them.

The following VB sample adds a header row column:

With Grid1.Columns.Add("H")
    .Def(exCellHasButton) = True
    .Position = 0
    .AllowDragging = False
    .HeaderAlignment = CenterAlignment
    .Width = 16
End With

The following VB sample assigns checkboxes for all cells in the first column: 

Grid1.Columns(0).Def(exCellHasCheckBox) = True

The following C++ sample adds a header row column:

#include "Column.h"
#include "Columns.h"
CColumns columns = m_grid.GetColumns();
CColumn column( V_DISPATCH( &columns.Add("H") ) );
column.SetHeaderAlignment( 1 );
column.SetDef(2, COleVariant( VARIANT_TRUE ) );
column.SetPosition( 0 );
column.SetWidth( 16 );
column.SetAllowDragging( FALSE );

The following C++ sample assigns checkboxes for all cells in the first column: 

COleVariant vtCheckBox( VARIANT_TRUE );
m_grid.GetColumns().GetItem( COleVariant( (long) 0 ) ).SetDef( /*exCellHasCheckBox*/ 0, vtCheckBox );

The following VB.NET sample adds a header row column:

With AxGrid1.Columns.Add("H")
    .Def(EXGRIDLib.DefColumnEnum.exCellHasButton) = True
    .Position = 0
    .AllowDragging = False
    .HeaderAlignment = EXGRIDLib.AlignmentEnum.CenterAlignment
    .Width = 16
End With

The following VB.NET sample assigns checkboxes for all cells in the first column: 

With AxGrid1.Columns(0)
    .Def(EXGRIDLib.DefColumnEnum.exCellHasCheckBox) = True
End With

The following C# sample adds a header row column:

EXGRIDLib.Columns columns = axGrid1.Columns;
EXGRIDLib.Column column = columns.Add("H") as EXGRIDLib.Column;
column.set_Def(EXGRIDLib.DefColumnEnum.exCellHasButton, true);
column.Position = 0;
column.HeaderAlignment = EXGRIDLib.AlignmentEnum.CenterAlignment;
column.AllowDragging = false;
column.Width = 16;

The following C# sample assigns checkboxes for all cells in the first column: 

axGrid1.Columns[0].set_Def( EXGRIDLib.DefColumnEnum.exCellHasCheckBox, true );

The following VFP sample adds a header row column:

with thisform.Grid1.Columns.Add("H")
	.Position = 0
	.Def(2) = .t.
	.AllowDragging = .f.
	.Width = 16
endwith

The following VFP sample assigns checkboxes for all cells in the first column:

with thisform.Grid1.Columns(0)
	.Def( 0 ) = .t.
endwith