Results 1 to 8 of 8

Thread: How can i detect what key has been pressed on a form that has command buttons on it?

Threaded View

  1. #3
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: How can i detect what key has been pressed on a form that has command buttons on

    I don't think you can trap the arrow keys (or the tab key) using native VB. Maybe if you subclassed?

    My standard workaround is to rethink my GUI design. If I really absolutely must implement custom arrow navigation, I use the number pad. (Have "4" do the desired left arrow action, "8" does up, et cetera...)

    EDIT: akhileshbc, pictureboxes are better for hiding focus. They have the advantage of not displaying a blinking caret.

    EDIT2: I just had a thought: if you set every control's TabStop property to False, you might be able to trap arrow keys manually in the Key events since they wouldn't be initiating any navigation. You'd then need to manually handle tabbing, but at least it's worth a shot.
    Last edited by Ellis Dee; Oct 20th, 2010 at 11:37 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
  •  



Click Here to Expand Forum to Full Width