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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escape Key

Status
Not open for further replies.

YL99

Programmer
Dec 23, 2002
24
0
0
GB
Hi,

When pressing the EscapeKey I want it to execute the Cancel button Click Event. I have set the KeyPreview for the form to true and catch the Escape Key in the Form_KeyPress Event.

But doesn't seem to call the Cancel button procedure

Your help will be much appreciated.

 
Set the Cancel buttons Cancel property to Ture
 
Hi

I'm assuming that you have a cancel button on the form... (unless I misunderstand you)

set that button's "cancel" property to true. this will cause the buttons click event to fire when escape is pressed.

Regards
Steve
 
Hi,
Is there an event that u can use to check if the EscapeKey is pressed.

I've tried the form_Keypress but doesn't execute this event, instead it perform the cancel button procedure
 
try using keyup or keydown events with a breakpoint to see the argument value. That's how I do my hotkeys. I vaguely remember some quirky things about keypress and certain keys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top