Keypress & Keydown Event Handling
I am new to VB.Net and would like to create keystroke event handling at the Form level. I understand that the Form's KeyPreview property must be set to True. I want to intercept the <Enter> key even when Button objects are on the form. I create two event handlers within the form's code something like this:
Sub KPress(ByVal o as Object, ByVal e as KeyPressEventArgs) Handles MyBase.KeyPress
e.Handled = True
msgbox("Form Intercepted the KeyPress")
End Sub
and
Sub KDown(ByVal o as Object, ByVal e as KeyEventArgs) Handles MyBase.KeyDown
e.Handled = True
msgbox("Form Intercepted the KeyDown")
End Sub
However, when a Button has the Focus, the Button's Click event handles the keystroke, not the Form.
Thanks for your help...in advance,