Compartir a través de


Value Property

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

[Form.]Control.Value [= nSetting]

Return Value

  • nSetting
    Specifies a setting that indicates the current state of the control.

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

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

    For a CheckBox control, the following table lists the settings for nSetting:

    nSetting

    Description

    0

    Cleared. (Default)

    1

    Selected.

    2

    Mixed-value. This setting is only available in code.

    For an OptionButton control, the following table lists the settings for nSetting:

    nSetting

    Description

    0

    Not selected. (Default)

    1

    Selected.

Remarks

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

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

The Value method does not support the Assign method.

You can use the Value property of a CommandGroup or OptionGroup control to determine which button in the group triggers an event. The Value property 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 table lists 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

Reference

Bound Property

ListIndex Property (Visual FoxPro)

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)