Focus at the right spot

  • Thread starter Thread starter Arne Garvander
  • Start date Start date
A

Arne Garvander

I use
Mytextbox.text = "Default"
mytextbox.focus

How do I focus on the first character in the text box?
 
You need to change the selection within the textbox. This is done with the
SelectionStart and SelectionLength properties. The start is the start
position for selection, the length is the number of characters to be
selected from that point or zero for no selection, just your flashing
cursor. For example, the following code moves the cursor to just after the
fifth character in the textbox.

textBox1.SelectionStart = 5;
textBox1.SelectionLength = 0;
 
BlackWasp said:
You need to change the selection within the textbox. This is done with
the SelectionStart and SelectionLength properties.

.... or via the control's parameterized 'Select' method.
 
Back
Top