|
-
Jan 26th, 2000, 07:46 PM
#1
Thread Starter
Hyperactive Member
I cant seem to get Keypress to work.
I have a form, when the user presses ESC I want an event to happen. I have tried
Private Sub Form_KeyPress(KeyAscii As Integer)
Keydown and Keyup, none of these seem to work. Is Form_.... the right place, or should it be somewhere else????
My form is a MDIChild.
-
Jan 26th, 2000, 08:06 PM
#2
Hyperactive Member
Hello Rick,
The keypress will only work for your form if it is an empty form.
If you have components on your form I do think all of them heve to configured for your ESC key.
Nice regards,
michelle.
-
Jan 26th, 2000, 08:23 PM
#3
Thread Starter
Hyperactive Member
I thought about that, but its a bit long winded.
I was wondering wether I could have an invisable button with an accelerator (short cut) key, but I`m not sure if its possible to implement shortcut keys with buttons. do you know if this is possible?
-
Jan 26th, 2000, 08:23 PM
#4
Hyperactive Member
Set the keypreview property of the form to True, then you can use the form_keydown event to catch the escape key (and if you need to know what control has the focus, you can use ActiveControl( .Name ) )
Hehe you replied while I replied... you can set the Cancel property of a commandbutton to true, but the button needs to be visible.
[This message has been edited by Crazy D (edited 01-27-2000).]
-
Jan 26th, 2000, 08:26 PM
#5
Thread Starter
Hyperactive Member
I know!, I got there first though. I have used the Keypreiew option, works a treat.
Cheers
[This message has been edited by Rick H (edited 01-27-2000).]
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
|