Keep Focus in Password TextBox

I have a password program and it doesn't keep the "Focus" in the textbox. I have it run from the startup folder and it loads with other programs and looses its focus. You have to put the mouse prompt in the box and click to get the focus back. Could someone list some code that will eliminate this?
Thanks A Lot
dropforkAsked:
Who is Participating?
 
wenchangConnect With a Mentor Commented:
did u set teh focus in the password textbox in the first place....
on form load ...
txtPassWord.SetFocus
0
 
wenchangCommented:
did u set the focus in the password textbox in the first place....
on form load ...
txtPassWord.SetFocus
0
 
dropforkAuthor Commented:
Hey Wenchang: I don't have this routine in my form load. My form load gets me the user name and restricts the form and mouse. The OK (command1 button) is where my txtpassword is. I can put your code in this area but it has no effect. If I put it in the form load area, I get "error city" because txtpassword is not in this area ? Maybe you can give me an example in another way. Maybe there is not a way with the way I have made this program.
(The mouse is restricted to the password form. The user name is called from the form load area. The txtpassword is located in the command1 "OK button" area). Everything works better this way for my program. (don't ask) If you have enough information from the above you can give it another shot if you want. I may be stuck with a trial and error situation because of the way this program was constructed.
Thanks for any further input...
0
 
caraf_gCommented:
Try this:
On the form's Activate event, set focus to the control in question.
0
 
dropforkAuthor Commented:
Caraf's way was correct for me. Wenchang's way was correct too but not applicable under my weird program. I wish to thank caraf for answering my "weird problem" and Wenchang for giving the normal correct answer...
Thanks Again !
0
All Courses

From novice to tech pro — start learning today.