Format Property

Specifies the input and output formatting of a control's Value property. Available at design time and run time.

Control.Format[ = cFunction]

Return Value

  • cFunction
    Specifies the character constraints for data entry and formatting for display.

    The following table lists the valid cFunction values for the appropriate controls.

cFunction Description

EditBox control

K

Selects all the text when the control gets focus.

Spinner control

$

Displays the currency symbol.

^

Displays numeric data using scientific notation.

K

Selects all the text when the control gets the focus.

L

Displays leading zeros instead of spaces in the text box.

R

Displays the format mask for the text box that is specified in the InputMask property.

The mask formats data for easier entry and clearer display (for example, if the mask is 99-999, the number 12345 is displayed as 12-345), but is not stored as part of the data. Use only with character or numeric data.

TextBox control and Column object

!

Converts alphabetic characters to uppercase. Use with data of Character type only.

$

Displays the currency symbol. The ControlSource property must specify a numeric source for the text box.

^

Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the text box.

A

Allows alphabetic characters only with no spaces or punctuation marks.

D

Uses the current SET DATE format.

E

Edits Date values as British dates.

F

Prevents Varchar values from being padded with trailing spaces in text boxes or Varbinary values from being padded with trailing zeroes (0s).

NoteNote

For text boxes bound to data with Varchar type, the MaxLength property must be set to a nonzero value to permit input for the desired number of characters.

NoteNote

When you drag a field with Varchar type to a form, the created text box's Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field. When you drag a Grid control to a form and create TextBox controls for columns with Varchar type, the Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field.

NoteNote

When you drag a field with Varbinary type to a form or when you drag a Grid control to a form and create TextBox controls for columns with Varbinary type, the following occur:

  • Format property is set to "F".

  • MaxLength property is set to the maximum length multiplied by 2 for the Varchar field.

  • InputMask property is filled with "H" up to the value of the MaxLength property.

K

Selects all the text when the control gets the focus.

L

Displays leading zeros instead of spaces in the text box. The ControlSource property must specify a numeric source for the text box.

M

Included for backward compatibility.

R

Displays the format mask for the text box that is specified in the InputMask property.

The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.

T

Trims leading and trailing blanks from the input field.

YS

Displays Date values in a short date format determined by the Windows Control Panel short date setting.

YL

Displays Date values in a long date format determined by the Windows Control Panel long date setting.

EditBox control, TextBox control, Column object, and Spinner control

Z

Displays the value as blank if it is 0, except when the control has focus.

Dates are also supported in these controls. The / / date delimiters are not displayed unless the control has focus.

Remarks

Applies To: Column Object | ComboBox Control | EditBox Control | Spinner Control | TextBox Control (Visual FoxPro)

The Format property specifies a behavior for the entire input field. You can mix several Format codes, but they always affect everything in the input field. This property contrasts to the InputMask property in which each entry in the input mask corresponds to an entry in the input field.

The Format property mimics the behavior of the FUNCTION clause in the @ ... GET and @ ... EDIT commands.

See Also

Reference

DynamicInputMask Property
Value Property
InputMask Property

Other Resources

Properties (Visual FoxPro)
Language Reference (Visual FoxPro)