Visual Basic Properties 101: Text Box - a box that contains text.

The main property of a textbox is .Text this contains a value.


Textbox.text = "Hello world" :: Would set the value at run time.
My string = Textbox.text :: would read out the value.

Better less crashable Example:

Textbox.Value = "Hello world" :: Would set the value at run time.
My string = Textbox.value :: would read out the value.

Interestingly if you try to use Textbox.text which due to some fairly complicated object theory the text ("Physicly typed in") is different in terms of how you use it to the value stored even though they may be the same. To paste text into a text box you would need to use Textbox.Setfocus which is the code version of clicking on the text box to put the curser there.

The textbox control has a large number of properties these are the "main" ones (The ones I use most).

Property          Effects

Text	         Text (as mentioned)
MultiLine         whether the text box can display multiple lines
Visible	         Can I see it?
Active	         Can it be used?
BackColor         Background Colour
BackStyle         Back style - Opaque or Transparent
ForeColor         Text Colour
Value             The string value of the text 
SelLength         Length of a given selection
SelText	         Selected Text
SelStart          Start Position of a given selection
Name	         TextBox Name Unless you have a real good reason for messing with 
                  this other than in runtime just don't do it.
The main functionality you are likely to want to explore is that of the text content. If your program is going to allow users to enter text that you wish to manipulate in some way (say for a database or basic notepad clone) then you will need to act on the Textbox.Text property.

You may wish to investigate rich textbox.
I once was sure others would love to give greater depth with further WU's.