How do I position the cursor to a specif textbox

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

I want to be able to position the curson to a specific textbox in certain
occasions.
How can I do that ?

//Tony
 
Hello!

This works in the situation when I input something that is not valid and
want to set the cursor back so a
correction can be made.

Now I want to set the cursor as soon as the form is displayed.
In a way fetch the event when the form is displayed and here set the cursor
to a specic textbox.

//Tony
 
Tony Johansson skrev:
Hello!

This works in the situation when I input something that is not valid and
want to set the cursor back so a
correction can be made.

Now I want to set the cursor as soon as the form is displayed.
In a way fetch the event when the form is displayed and here set the cursor
to a specic textbox.

As Peter says: use Control.Focus()

If you want to do this when the form is loaded, well do that in the Load
event.

If you want a specific position or having the initial text selected you
use the selection parameters of the text box as well.
 
Tony Johansson skrev:




As Peter says: use Control.Focus()

If you want to do this when the form is loaded, well do that in the Load
event.

If you want a specific position or having the initial text selected you
use the selection parameters of the text box as well.

I have found that Control.Focus() doesn't work in the form Load event,
but does in the form Shown event.
 
Back
Top