Winforms menu shortcuts not working sometimes? Use ProcessDialogKey()

My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2003/10/27/winforms-menu-shortcuts-not-working-sometimes-use-processdia.html
Published Monday, October 27, 2003 9:40 AM by RoyOsherove
Filed under:

Comments

Sunday, November 09, 2003 5:24 PM by Jim

# re: Winforms menu shortcuts not working sometimes? Use ProcessDialogKey()

I've searched far and wide to find this solution. I see how this strategy works, but I can't figure out for the life of me how to call ProcessDialogKey and what to pass to it. When and when Do I call it or initialize it so it actually is called when an arrow key is pressed?
I'm not using derived forms. I'm just trying to catch the arrow keys in a form.

thanks for taking to time to write this and help out.
jim@vod1.net
Sunday, November 09, 2003 5:36 PM by Roy Osherove

# re: Winforms menu shortcuts not working sometimes? Use ProcessDialogKey()

Jim. Yes you are using derived forms. In your form, where you try to capture the arrow keys, you are actually deriving form windows.forms.Form. So, the easiest way to get into ProcessDialogKey is this: In the Class tree window find your form. Go to it's base classes node and find "Form". go to that node's base classes node and find "control". You should see the "ProcessDialogKey" method listed there. Right click on it and select "Add override".

That's the "loooong" GUI way. You can easily just copy paste the code form this post inside your form. It will work just the same. No need to initialize it or anything else.
hope this helps..
Friday, September 29, 2006 6:34 AM by Florin

# re: Winforms menu shortcuts not working sometimes? Use ProcessDialogKey()

How about VB.NET 2005 "looong" Gui Way? Because the short one does not work at all.