Partilhar 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.

 [Form.]Control.DisplayValue[ = Expr]

Property Values

  • Expr
    If DisplayValue is a character string, specifies the value of the first column of the selected item. If DisplayValue is numeric, specifies the index of the selected item.

Remarks

Use the DisplayValue property when a ComboBox or ListBox has more than one column and the control's BoundColumn property is set to a value greater than 1. The text displayed in the text box portion of the ComboBox is specified by DisplayValue when DisplayValue is a character string.

Note   When a ComboBox or ListBox has only one column, the DisplayValue property and Value property of the control usually will have the same setting if both contain character strings. An exception is when both contain character strings and a value is typed into a drop-down ComboBox and that value does not exist in the drop-down list. In this case, the value will be "", and the DisplayValue will be the typed in value.

See Also

BoundColumn Property | Value Property

Applies To: ComboBox | ListBox