PDA

Click to See Complete Forum and Search --> : set focus


badgers
Jan 4th, 2000, 10:08 PM
I want to place a command in the form_load event to put the cursor in a text box.
My intention is that when someone runs the program they can just start typing, rather then click the mouse in the text box before they can type.
how can I do this?

------------------
I am so skeptacle, I can hardly believe it!

badgers
Jan 4th, 2000, 10:12 PM
never mind I am a tard!!!!

Janitor
Jan 4th, 2000, 10:12 PM
Just use the statement on the load of the form: text_box1.SetFocus

badgers
Jan 4th, 2000, 10:14 PM
janitor that doesn't work in the form_load event unless it has the me.show before the setfocus command. That was my problem, I did not have the me.show command in form load

[This message has been edited by badgers (edited 01-05-2000).]

ravcam
Jan 5th, 2000, 08:31 AM
Actually I think you can just set one of the properties in the porperties window to default the text box. I forget which one and I maybe wrong about the fact althogether! Does someone wish to correct me?

MartinLiss
Jan 5th, 2000, 11:15 AM
You would actually probably be better of putting it in Form_Activate. Putting it there eliminates any need for Me.Show, and, if you have the kind of app where this form is hidden and then shown again, your textbox will have the focus.

------------------
Marty

badgers
Jan 5th, 2000, 11:17 AM
thank you that is a good idea!

Aaron Young
Jan 5th, 2000, 11:49 AM
Why don't you just set the Textbox's TabIndex to Zero?
Then it'll have Focus when the Form Loads.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com