Text

This property returns and sets the text contained in the edit area of a ComboBox control or TextBox control, or returns and sets the item in a ListBox control.

Syntax

object.Text [= string]

Parameters

object
Object expression that evaluates to a ComboBox, ListBox, or TextBox control.
string
String expression that specifies text.

Remarks

At design time only, the defaults for the Text property are the control's Name property for ComboBox and TextBox controls and a zero-length string ("") for the ListBox control.

For a ComboBox with the Style property set to 0 (drop-down combo box) or to 1 (combo box) or for a TextBox control, this property is useful for reading the actual string contained in the edit area of the control. For a ComboBox or ListBox control with the Style property set to 2 (drop-down list box), you can use the Text property to determine the currently selected item.

The Text setting for a TextBox control is limited to 2,048 characters unless the MultiLine property is True, in which case the limit is about 32 KB.