VAFormat
Applies to
VACombo, VAList, VAText
Description
This property permits you to specify format strings for the field values displayed by the control.
Remarks
See the Visual Basic Language Reference documentation of the Format function for a list of valid format strings and their meanings.
For VAList control in multi-column record list mode (
VARecordList
property is
True
), the
VAFormat
property can contain a list of formats (one for each field specified in the
VAFieldName
property of the control) separated by semicolons.
The VAFormat property exists to arrange your data using format strings similar to those used in Visual Basic. The common Visual Basic format strings (see Table
32
) are predefined and there is also support for custom formats for dates and numbers. See the
Visual Basic Language Reference
for information on how these work.
Table 32
Common Visual Basic Format Strings
Format String
Description
(Empty String)
Default format. Displays numbers using General Number format, currency amounts, using the Currency format, dates and times using the using the General Date format, logical fields using True/False format.
General Number
Display number as is, with no thousand separators.
Currency
Display number with thousand separator, if appropriate; display two digits to the right of the decimal separator. Note that output is based on system locale settings.
Percent
Display number multiplied by 100 with a percent sign (%) appended to the right; always display two digits to the right of the decimal separator.
True/False
Display False if number is 0; otherwise, display True.
General Date
Display a date and/or time. For real numbers, display a date and time (for example, 4/3/93 05:34 PM); if there is no fractional part, display only a date (for example, 4/3/93); if there is no integer part, display time only (for example, 05:34 PM). Date display is determined by your system settings.
Long Date
Display a date according to your system’s long date format.
Short Date
Display a date using your system’s short date format.
Long Time
Display a time using your system’s long time format: includes hours, minutes, seconds.
Short Time
Display a time using the 24-hour format (for example, 17:45).
Custom numeric formats can be used similar to the formats provided by Visual Basic, but not all options are supported.
•
Embedded string literals - + ( ) $ can be used. This allows one to format a phone number, i.e. (000)000-0000
•
Other embedded strings using '\' or "" will not work.
•
Customized scientific notation will not work.
•
'0' placeholders work correctly. Float values will display fractional digits unless explicitly restricted.
•
'#' placeholders work for integers. Float values may be truncated unexpectedly and will display fractional digits unless restricted.
When using day-of-the-week displays, rounding errors can result in the wrong day being shown for times close to midnight.
Example
VAccess1.TableName = "Billing"
VAText1.FieldName =
"
Amount_Due
"
VAText1.VAFormat =
"
Currency
"
VAText2.FieldName =
"
Log
"
VAText2.VAFormat =
"
mmm ddd yyyy
"