|
-
May 6th, 2003, 05:19 AM
#1
Thread Starter
Fanatic Member
Enter button to submit command
I made a password field and when i type my password, i want to easily press my Enter button and it presses a command button for me on the form.
How would i make it do this? When i press my Enter/Return button, a command button gets pressed
-
May 6th, 2003, 05:21 AM
#2
Fanatic Member
what about
VB Code:
Private Sub txtinformation_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
cmdenter_Click
End If
Exit Sub
End Sub
Thanks
** HOLLY ** 
-
May 6th, 2003, 06:16 AM
#3
Fanatic Member
Or set the default property of a Command button to True. This will make the command button pressed when ever you press the Enter button.
And you can do same with the ESC key by setting the Cancel property of a command button to true
-
May 6th, 2003, 06:35 AM
#4
Thread Starter
Fanatic Member
ah cool thanks for the quick reply
two methods, ill try both!
Thanks, cya
-
May 6th, 2003, 06:45 AM
#5
Instead of keypress you can have the keydown event. It is almost the same thing. :
VB Code:
Private Sub txtinformation_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
cmdenter_Click
End If
Exit Sub
End Sub
Has someone helped you? Then you can Rate their helpful post. 
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
|