- To set the initial
focus to a text box you must set the control's
TabIndex property to
0. Be sure that the
TabStop
property is set to True.
- Use the
Focus command to move the focus to a particular control:
txtBox.Focus
- To clear the
contents of a text box, use a line like
txtBox.Text = vbNullString
- To display multiple
lines in a text box, set the
MultiLine property to
True and the
Scroll Bars
property to
ScrollBars.Both.
- To highlight the
text in a text box, use the following sequence of commands:
| txt1.Focus( ) |
' Move the focus to the text box |
| txt1.SelectionStart = 0
|
' Set cursor to beginning of box |
| txt1.SelectionLength =
Len(txt1.Text) |
' Set length of selection to contents length |
TestBox
Control Changes in Visual Basic .NET
|