VS 2010 How to detect a keypress in vb2010-VBForums
Results 1 to 4 of 4

Thread: How to detect a keypress in vb2010

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    How to detect a keypress in vb2010

    I would like the program to detect a key press and then report that key to a MsgBox

    I have the code for the message box thats easy, and I have
    Any help is welcome

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    86,080

    Re: How to detect a keypress in vb2010

    Handle the KeyPress of the appropriate control. If it's the form, make sure you set the KeyPreview property to True, so it raises keyboard events no matter what control has focus.

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    Re: How to detect a keypress in vb2010

    Thank you for the tid bit, I didn't change that proerty, but I want it to be able to tell what key is pressed, such as


  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    Re: How to detect a keypress in vb2010

    Found the code, I am using Asc(e.keychar())

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.