SetFormat

Description

Specifies a display format for a column in a DataWindow control or DataStore.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore object


Syntax

PowerBuilder

integer dwcontrol.SetFormat ( string column, string format )
integer dwcontrol.SetFormat ( integer column, string format )

Argument

Description

dwcontrol

A reference to a DataWindow control, DataStore, or child DataWindow.

column

The column for which you are specifying the display format. Column can be a column number or a column name.

format

A string whose value is the display format for the DataWindow column.


Return value

Returns 1 if it succeeds and -1 if an error occurs. The return value is usually not used.

If any argument's value is null, in PowerBuilder and JavaScript the method returns null.

Usage

For information on valid display formats for different datatypes, see the section called “Defining display formats” in Users Guide.

If you are specifying the display format for a number, the format must use U.S. notation. For example, comma (,) represents the thousands delimiter and period (.) represents the decimal place. At runtime, the locally correct symbols will be displayed.

An EditMask edit style supersedes any display format applied to the column. When the column has an EditMask edit style, calling SetFormat has no effect.

Examples

These statements define the display format for column 15 of dw_employee to the contents of format1:

string format1
format1 = "$#,##0.00"
dw_employee.SetFormat(15, format1)

See also

GetFormat