Specifies the format for displaying and printing numbers, dates, times, and text.
Syntax
[form.]MaskedEdit.Format [ = posformat$; negformat$; zeroformat$; nullformat$]
Parameter | Description |
posformat$ | Expression used to display positive values. |
negformat$ | Expression used to display negative values. |
zeroformat$ | Expression used to display zero values. |
nullformat$ | Expression used to display null or empty values. |
Remarks
The Format property defines the format expressions used to display the contents of the control. You can use the same format expressions as defined by the Visual Basic Format function, with the exception that named formats ("On/Off") can't be used.
This property can have from one to four parameters separated by semicolons. If one of the parameters is not specified, the format specified by the first parameter is used. If multiple parameters appear, the appropriate number of separators must be used. For example, to specify posformat$ and nullformat$, use the syntax
[form.]MaskedEdit.Format = posformat$;;; nullformat$
The following table shows examples of standard formats that you may wish to use.
Data type | Value | Description |
Number | (Default) Empty string | General Numeric format. Displays as entered. |
Number | $#,##0.00;($#,##0.00) | Currency format. Uses thousands separator; displays negative numbers enclosed in parentheses. |
Number | 0 | Fixed number format. Displays at least one digit. |
Number | #,##0 | Commas format. Uses commas as thousands separator. |
Number | 0% | Percent format. Multiplies value by 100 and appends a percent sign. |
Number | 0.00E+00 | Scientific format. Uses standard scientific notation. |
Date/Time | (Default) c | General Date and Time format. Displays date, time, or both. |
Date/Time | dddddd | Long Date format. Same as the Long Date setting in the International section of the Microsoft Windows Control Panel. Example: Tuesday, May 26, 1992. |
Date/Time | dd-mmm-yy | Medium Date format. Example: 26-May-92. |
Date/Time | ddddd | Short Date format. Same as the Short Date setting in the International section of the Microsoft Windows Control Panel. Example: 5/26/92. |
Date/Time | ttttt | Long Time format. Same as the Time setting in the International section of the Microsoft Windows Control Panel. Example: 05:36:17 A.M. |
Date/Time | hh:mm AM/PM | Medium Time format. Example: 05:36 A.M. |
Date/Time | hh:mm | Short Time format. Example: 05:36. |
Data Type
String