ComponentOne VSView Reporting Edition
Format Property

Returns or sets how the Field's contents should be formatted.

Syntax

field.Format[ = value As String ]

Remarks

You can use the Format property to customize the way numbers, dates, times, and text are displayed and printed. For example, if you've created a Price field, you can set its Format property to "Currency". If the field value is set to "4321.678", it would be rendered as $4,321.68.

The Format property affects only how data is displayed. It doesn't affect how data is stored.

You can use the Format property to format numbers (including currency and percentage values), dates, boolean values, and strings. The syntax is similar to the syntax used in Visual Basic's Format function. The table below shows some examples:

 

Value

Format

Result

#12:45#

Long Time

12:45:00 PM

#12:45#

Short Time 

12:45

#12/12/97#

Long Date

Friday, December 12, 1997

#12/12/97#

Short Date

12/12/1997

#12/12/97#

Medium Date

12-Dec-97

#12/12/97#

q

4 (quarter)

#12/12/97#

m

12 (month)

#12/12/97#

d

12 (day of the month)

#12/12/97#

w

6 (day of the week)

#12/12/97#

yyyy

1997 (year)

4321.678

Currency

$4,321.68

4321.678

$

$4,321.68

4321.678

General Number

4321.678

0.678

Percent

67.80%

4321.678

#,###.#

4,321.7 (mask)

1

Yes/No

True

"True"

Yes/No

True

True

Yes/No

True

0

Yes/No

False

"North"

"NORTH"

"North"

"north"

"123456"

@@-@@-@@

"12-34-56"

 

NOTE: The Format function is built into Visual Basic, but not into VBScript. To use the VBScript formatting functions (for example, FormatNumber, FormatDateTime, DatePart, etc), add them directly to the field's Text property, and leave the Format property blank. For example:

theField.Text = "DatePart(""q"", HiredDate)"

theField.Calculated = True

Data Type

String

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback