|
-
Jun 1st, 2000, 03:38 AM
#1
Thread Starter
Hyperactive Member
in a current project, in the keypress events of the majority of the controls, I have
Code:
If KeyAscii = vbKeyEscape Then
Call cmdExit_Click
End If
so that whenever the user hits the escape key, the code in cmdExit_Click fires and then the form unloads. It works fine as is, but multiply 3 lines of code times the total number of controls in my project and I have an astronomical amount of code dedicated to unloading forms with the escape key.
My question - is there any way to slim down the amount of code and have the same effects? As in, a module or function or something that will fire when the user presses the escape key, no matter which control has the focus? I am thinking that it is not possible since so much of the functionality of VB is driven by which control has the current focus, but I thought I would give you computer brains here a try anyway. IS this possible, or am I dreaming the impossible?
Thanks
Andrew
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
|