See Also Example
Applies To
Combo box, list box
Description
Combo box (Style property set to 0 (Dropdown Combo) or to 1 (Simple Combo)) and text box
determines the text contained in the edit area.
Combo box (Style property set to 2 (Dropdown List)) and list box
determines the selected item in the list box; the value returned is always equivalent to the value returned by the expression List(listindex). Read-only at design time; read-only at run time.
Usage
[form.]{ combobox|listbox|textbox}.Text[ = stringexpression ]
Remarks
At design time only, the defaults for the Text property are:
Combo box and text box
the control's Name property.
List box
an empty string ("").
For a combo box with Style property set to 0 (Dropdown Combo) or to 1 (Simple Combo), or for a text box, this property is useful for reading the actual string contained in the edit area of the control. For a setting 2 (Dropdown List) combo box or for a list box, you can use the Text property to determine the currently selected item.
The Text setting for a text box is limited to 2048 characters unless the MultiLine property is True, in which case the limit is about 32k.
Data Type
String
Help:
SelLength, SelStart, SelText Properties
Value Property
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
The example illustrates the Text property. To try this example, paste the code into the Declarations section of a form that contains three text boxes and a command button. Then press F5 and type something into Text1.
Sub Text1_Change ()
Text2.Text = LCase(Text1.Text)' Display text as lowercase.
Text3.Text = UCase(Text1.Text) ' Display text as uppercase.
End Sub
Sub Command1_Click () ' Delete text.
Text1.Text = ""
End Sub