Share via


Value Property

Specifies the current state of a control. Available at design time and run time.

[Form.]Control.Value[ = nSetting]

Property Values

  • nSetting
    For a CheckBox control, the settings for the Value property are:

    Setting Description
    0 (Default) Unchecked.
    1 Checked.
    2 Mixed-value. This setting is only available in code.

    For CommandGroup, ComboBox, EditBox, ListBox, OptionGroup, and Spinner controls, the setting for the Value property is the character string or numeric value that is currently selected.

    For an OptionButton control, the settings for the Value property are:

    Setting Description
    0 (Default) Indicates the button isn't selected.
    1 Indicates the button is selected.

    For a TextBox control, the setting for the Value property is the character string or numeric, date, datetime, currency, or logical value that is currently selected. The default setting is a character string.

Remarks

For the Grid control, the Value property is available only when the Grid control has the focus.

The Value method does not support the Assign method.

The Value property of a CommandGroup or OptionGroup control can be used to determine which button in the group caused an event. It is set to an integer that indicates which button in the group caused the event.

The Value property changes behavior when a control source is set for a control. When a control source is set, the Value property setting of a control is the data type of the variable or field referenced by the ControlSource property. If the data type is not valid for the given control, Visual FoxPro generates an error.

The following is a list of valid data types:

Control Data Types allowed
CheckBox Integer, Logical, Numeric
ComboBox Character, Integer, Numeric
CommandGroup Character, Integer, Numeric
EditBox Character, Memo
Grid Character, Numeric
ListBox Character, Integer, Numeric
OptionButton Integer, Logical, Numeric
OptionGroup Character, Integer, Numeric
Spinner Currency, Integer, Numeric
TextBox Any data type

See Also

Bound Property | ListIndex Property

Applies To: CheckBox | ComboBox | CommandGroup | EditBox | Grid | ListBox | OptionButton | OptionGroup | Spinner | TextBox