|
-
Jun 9th, 2007, 07:51 PM
#1
[RESOLVED] [2005] Prevent arrow keys changing focus
I have a form with a dozen checkboxes, textboxes etc, all with TabStop = False. However if I press the Left and Right arrow keys, the focus will still shift along between the different controls.
I want to use the L/R arrow keys for a specific purpose on the main form (but obviously, when used as required, they are also changing the state of other controls at the same time).
Can I prevent this? KeyPreview has no effect on this, I cant seem to stop this happening within any key events either.
-
Jun 10th, 2007, 01:12 AM
#2
Re: [2005] Prevent arrow keys changing focus
I beleve the textbox KeyDown fires on this keys so you can make some work around for this. If nothing works then I have posted Global Hooks in the code bank (check it in my signature) so that it hooks the keyboard globaly and fires the KeyDown event before the windows get the message. The KeyDown event argument has "Handled" property so you can set it to True in the event handler so that the windows will not get this message. Note it is global so the message will not pass to any window not just your app.
The project is a Library project so that you need to bult it and copy the WindowsHookLib.dll file in to your project and reference it. If you want the methods coments then copy the xml file too.
Last edited by VBDT; Jun 10th, 2007 at 01:48 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|