Link to home
Start Free TrialLog in
Avatar of ethnarch
ethnarch

asked on

how do you get the cursor into a textbox on form load

By default it seems all programs don't put the cursor into the textbox when the form loads and consequently you have to click into the textbox.

So how do i get the cursor in there so that the user no longer has to click into the textbox when the form loads?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Set the Tabindex in the order you want the cursor to go from cotrol to control
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also to hide the tabindex number from the design form click View->Tab Order
Avatar of gangwisch
gangwisch

can't you just do textbox1.focus()
Much easier to do it at design time through the GUI then to put a number of TextBox##.Focus() in the code especially if someone would like to change the order after you are done.  But it is a matter of preference.
Avatar of ethnarch

ASKER

I tried it through textBox1.focus() and it did not work maybe in code the textbox was in focus but it doesn't make the cursor appear.
setting the tabindex to 0 does not work either or 1 i tried both and neither puts the cursor in the textbox i want
ahh i see why none of this stuff worked i forgot about the tabindex of the group now i feel really stupid
so thanks to fernando
     Qoute:  An easy way to set tab order is in the design window click on the form then from the menu View->Tab Order.       The just click on each control in the order the you want the controls to be selected by pressing the tab key.           When the program first starts it will go to tab index 0.