Text Property

See AlsoAY6Y4SA              Example2JCHZ1D>Low

Applies To

Combo box1YZXFF6, list boxG11UCK, text boxYPYZDG.


         Combo box (Style1L09GO8 property set to 0 (Dropdown Combo) or to 1 (Simple Combo)) and text boxdetermines the text contained in the edit area.

         Combo box (Style property set to 2 (Dropdown List)) and list boxdetermines 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.



[form.]{ combobox|listbox|textbox}.Text[ = stringexpression ]


At design time only, the defaults for the Text property are:

         Combo box and text boxthe control's Name2016V9P property.

         List boxan 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


See Also


SelLength, SelStart, SelText PropertiesKLDRUM

Value Property5OIC88B


Programmer's Guide:

Chapter 3, "Creating and Using Controls"

Text Property Example

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