IDataGridColumn.ValueFormat

Syntax

ValueFormat: String;

Description

The ValueFormat property determines the table data display format.

Comments

This property does not depend on system localization, that is, if this property is set to some value, commas and spaces will be used as separators in the template.

A data format is generated using reserved format codes. Codes are described in the Number Format section.

This property value is affected by the IDataGridColumn.LocalValueFormat property: when the user determines value of the IDataGridColumn.LocalValueFormat property, this value is converted to a common form (ignoring regional settings) and is inserted to the ValueFormat property. Also, when the IDataGridColumn.LocalValueFormat property is set to some value, the property returns value of the ValueFormat property converted to a localized form according to regional settings.

Example

Executing the example requires a form, a button named Button1 positioned on it and the DataGrid component named DataGrid1. In the regional settings set a point as a decimal separator.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Column: IDataGridColumn;
    Format, LocalFormat: String;
Begin
    Column := DataGrid1.Columns.Item(0);
    Column.ValueFormat := "0,00";
    Format := Column.ValueFormat;
    LocalFormat := Column.LocalValueFormat;
End Sub Button1OnClick;

After executing the example the following format is set for the first column: number with two decimal places. The Format variable will store the following common template for a number not considering the regional parameters: 0,00. The LocalFormat variable will store (considering the regional parameters) the following template for a number: 0.00.

See also:

IDataGridColumn