

| Type | Description | |||
| Boolean | A boolean expression that indicates whether the control fires the FormatColumn event in order to format the caption for each cell in the column. |
Before running any of the following samples, please make sure that the control contains more than 3 columns, and the third column has the FireFormatColumn property on True. The following VB sample displays the sum of the first two cells, and put the result on the third one:
Private Sub List1_FormatColumn(ByVal ItemIndex As Long, ByVal ColIndex As Long, Value As Variant)
On Error Resume Next
With List1.Items
Value = Int(.Caption(ItemIndex, 0)) + Int(.Caption(ItemIndex, 1))
End With
End SubThe following VB sample displays long date format, using the FormatDateTime function:
Private Sub List1_FormatColumn(ByVal ItemIndex As Long, ByVal ColIndex As Long, Value As Variant)
On Error Resume Next
Value = FormatDateTime(Value, vbLongDate)
End SubThe following C++ sample displays the sum of the first two cells, and put the result on the third one:
void OnFormatColumnList1(long ItemIndex, long ColIndex, VARIANT FAR* Value)
{
CItems items = m_list.GetItems();
long newValue = V2I( &items.GetCaption( ItemIndex, COleVariant( long(0) ) ) );
newValue += V2I( &items.GetCaption( ItemIndex, COleVariant( long(1) ) ) );
V_VT( Value ) = VT_I4;
V_I4( Value ) = newValue;
}where the V2I function converts a VARIANT value to a long expression,
static long V2I( VARIANT* pv, long nDefault = 0 )
{
if ( pv )
{
if ( pv->vt == VT_ERROR )
return nDefault;
COleVariant vt;
vt.ChangeType( VT_I4, pv );
return V_I4( &vt );
}
return nDefault;
} The following C++ sample displays long date format:
void OnFormatColumnList1(long ItemIndex, long ColIndex, VARIANT FAR* Value)
{
COleDateTime date( *Value );
COleVariant vtNewValue( date.Format( _T("%A, %B %d, %Y") ) );
VariantCopy( Value, vtNewValue );
}The following VB.NET sample displays the sum of the first two cells, and put the result on the third one:
Private Sub AxList1_FormatColumn(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_FormatColumnEvent) Handles AxList1.FormatColumn
With AxList1.Items
Dim newValue As Integer = Integer.Parse(.Caption(e.itemIndex, 0), Globalization.NumberStyles.Any)
newValue = newValue + Integer.Parse(.Caption(e.itemIndex, 1), Globalization.NumberStyles.Any)
e.value = newValue
End With
End SubThe following VB.NET sample displays long date format:
Private Sub AxList1_FormatColumn(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_FormatColumnEvent) Handles AxList1.FormatColumn
e.value = DateTime.Parse(e.value).ToLongDateString()
End SubThe following C# sample displays the sum of the first two cells, and put the result on the third one:
private void axList1_FormatColumn(object sender, AxEXLISTLib._IListEvents_FormatColumnEvent e)
{
int newValue = int.Parse(axList1.Items.get_Caption(e.itemIndex, 0).ToString());
newValue += int.Parse(axList1.Items.get_Caption(e.itemIndex, 1).ToString());
e.value = newValue;
}The following C# sample displays long date format:
private void axList1_FormatColumn(object sender, AxEXLISTLib._IListEvents_FormatColumnEvent e)
{
e.value = DateTime.Parse(e.value.ToString()).ToLongDateString();
}The following VFP sample displays the sum of the first two cells, and put the result on the third one:
*** ActiveX Control Event *** LPARAMETERS itemindex, colindex, value with thisform.List1.Items value = .Caption(itemindex,0) + .Caption(itemindex,1) endwith