Share via


DisplayValue Property

Specifies the contents of the first column of the selected item in a ListBox or ComboBox control. Available at design time and run time.

Use the DisplayValue property when a combo box or list box has more than one column, and the control's BoundColumn property is set to a value greater than 1.

 [Form.]Control.DisplayValue[ = Expr]

Return Value

  • Expr
    Specifies a character string or numeric value. The following table describes the values of Expr.

    Expr

    Description

    Character string

    Specifies the value of the first column of the selected item.

    For combo boxes, DisplayValue specifies the text displayed in the text box portion of the combo box when DisplayValue is a character string. However, the ComboBox InputMask and MaxLength properties can affect its display.

    Numeric value

    Specifies the index of the selected item.

Remarks

Applies To: ComboBox Control | ListBox Control

When a combo box or list box has only one column, the DisplayValue property and Value property of the control usually have the same setting if both contain character strings. An exception exists when both properties contain character strings, and a value is typed in the combo box, but the value does not exist in the list. In this case, the value is an empty string (""), and DisplayValue will be the value that is typed in.

See Also

Reference

BoundColumn Property

Value Property

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)