Click to See Complete Forum and Search --> : Buttons and key events


luke101
June 24th, 2003, 11:45 AM
Hello I have a problem with my program.
I have my program setup to do a certain task when the 'enter' key is pressed. But if a button on the form has focus then that button is pressed when the enter key is pressed and ultimately the keyevent is not prossed. Is there a way to prosses all keyevents regardless of button focus.

Babbalouie
June 24th, 2003, 04:18 PM
Turn the Form's KeyPreview property to True. This allows the form to capture keystrokes before they are processed by the control on the form. To run the code whenever the "Enter" key is pressed, you will have to place the code in the KeyUp/Down/Press event of the form.

luke101
June 24th, 2003, 11:44 PM
thank you very much