property Column.FormatColumn as String
Specifies the format to display the cells in the column.

   String A string expression that defines the format to display the cell, including HTML formatting, if the cell supports it.  
By default, the FormatColumn property is empty. The cells in the column use the provided format only if is valid ( not empty, and syntactically correct ), to display data in the column. The FormatColumn property provides a format to display all cells in the column using a predefined format. The expression may be a combination of variables, constants, strings, dates and operators, and value. The value operator gives the value to be formatted.  A string is delimited by ", ` or ' characters, and inside they can have the starting character preceded by \ character, ie "\"This is a quote\"". A date is delimited by # character, ie #1/31/2001 10:00# means the January 31th, 2001, 10:00 AM. The cell's HTML format is applied only if the CellValueFormat or Def(exCellValueFormat) is exHTML. If valid, the FormatColumn is applied to all cells for which the CellCaptionFormat property is not exComputedField. This way you can specify which cells use or not the FormatColumn property. The FormatColumn and FormatCell properties support auto-numbering functions like explained bellow The ComputedField property indicates the formula of the computed column.

The CellValue property of the cell is being shown as:

In other words, all cells applies the format of the FormatColumn property, excepts the cells with the FormatCell property being set. If the cell belongs to a column with the FireFormatColumn property on True, the Value parameter of the FormatColumn event shows the newly caption for the cell to be shown.

For instance:

The value keyword in the FormatColumn property indicates the value to be formatted. 

The expression supports cell's identifiers as follows:

The expression predefined operators for auto-numbering are:

This property/method supports predefined constants and operators/functions as described here.

The following VB sample shows how can I display the column using currency:
With G2antt1
	.Columns.Add("Currency").FormatColumn = "currency(dbl(value))"
	With .Items
		.AddItem "1.23"
		.AddItem "2.34"
		.AddItem "0"
		.AddItem 5
		.AddItem "10000.99"
	End With
End With
The following VB.NET sample shows how can I display the column using currency:
With AxG2antt1
	.Columns.Add("Currency").FormatColumn = "currency(dbl(value))"
	With .Items
		.AddItem "1.23"
		.AddItem "2.34"
		.AddItem "0"
		.AddItem 5
		.AddItem "10000.99"
	End With
End With
The following C++ sample shows how can I display the column using currency:
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXG2ANTTLib' for the library: 'ExG2antt 1.0 Control Library'

	#import "C:\\Windows\\System32\\ExG2antt.dll"
	using namespace EXG2ANTTLib;
EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
The following C# sample shows how can I display the column using currency:
(axG2antt1.Columns.Add("Currency") as EXG2ANTTLib.Column).FormatColumn = "currency(dbl(value))";
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
The following VFP sample shows how can I display the column using currency:
with thisform.G2antt1
	.Columns.Add("Currency").FormatColumn = "currency(dbl(value))"
	with .Items

Send comments on this topic.
1999-2019 Exontrol.COM, Software. All rights reserved.