|
-
Jul 1st, 2005, 01:04 PM
#1
Thread Starter
Lively Member
Stupid Enter Key {RESOLVED}
This is such a stupid problem, its embarrassing how much time I'm spending on it.
I made a custom login form. When the user hits the Enter key while in the password textbox, I want the form to treat it as though they hit the OK button.
No problem, right? I'll just catch the Enter keypress in the txtPass_Keypress Event and have it run the command button code.
No. When I hit enter in the password textbox, it tabs to the next control on the form. In fact, the keypress event is never fired. If I type any other character, the keypress event is fired, but not with the Enter key. What gives? Anyone know what I'm doing wrong?
Last edited by mikeyc1204; Jul 1st, 2005 at 01:08 PM.
Reason: resolved
-
Jul 1st, 2005, 01:08 PM
#2
Thread Starter
Lively Member
Re: Stupid Enter Key
Well it works when I use the KeyDown event. Hate Excel.
-
Jul 1st, 2005, 01:08 PM
#3
Re: Stupid Enter Key
What code do you have in the key_press event?
-
Jul 1st, 2005, 01:12 PM
#4
Thread Starter
Lively Member
Re: Stupid Enter Key {RESOLVED}
This is what I had, just to make sure the event was firing
VB Code:
Private Sub txtPass_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
msgbox KeyAscii
End Sub
In testing, a messagebox comes up for every keypress with the ascii code, except the enter key. Just tabs to the next control.
This is what I would have liked it to be.
VB Code:
Private Sub txtPass_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then Call cmdOK_Click
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|