caputering the Escape key

  • Thread starter Thread starter T Perkins
  • Start date Start date
T

T Perkins

i would like to add the ability to close forms in my mdi application using
the "Esc" key.
i have not clue on how to add this, if anyone could guide me in the right
direction
i would greatly appreciatie..

thanks
tony
 
Tony,
Does your form have buttons?

You can set the CancelButton property of the form to the Button control that
represents close form. Then when the user presses Esc key that button will
be 'clicked'.

Otherwise you will need to handle the KeyPressed or KeyDown event and check
for the Esc key.

Hope this helps
Jay
 
T Perkins said:
i would like to add the ability to close forms in my mdi application using
the "Esc" key.

Add a button, set its 'DialogResult' property and set the form's
'CancelButton' property to the button.
 
Back
Top