Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling Esc key

Status
Not open for further replies.

Hargreavesk

Technical User
Jul 18, 2001
97
GB
Hi,

I would like to disable the "Esc" key from a form. I have set Key Preview to "yes" and put in Keycode = 0 on the "Key Up" event. However, "Esc" still works!!! Is there any other way I can stop it?

Regards

Kate
 
Try putting it in the KeyPress or KeyDown event instead. It is possible that the key is being processed and you are only getting control after it has already be activated, maybe similar to BeforeUpate and AfterUpdate. This is just a thought.

Good Luck!
 
SBendBuckeye is right. Use the OnKeyPress event of the form and also, set the KeyPreview property of the form to YES.
 
set form's keypreview property to yes as stated above.


In the form's keydown event put in the following:

If KeyCode = vbKeyEscape Then KeyCode = 0

Hope this helps

N
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top