Results 1 to 9 of 9

Thread: [RESOLVED] Shortcut keys do not work

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2009
    Posts
    168

    Re: [RESOLVED] Shortcut keys do not work

    What exactly are trying to do? Get the button1 to perform click? What keys you want to use to enable this shortcut? the control button and P? If, yes the try this:

    Code:
    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyData = Keys.Control And e.KeyData = Keys.P Then
    Me.Button1.PerformClick()
    End If
    End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] Shortcut keys do not work

    Quote Originally Posted by gate7cy View Post
    What exactly are trying to do? Get the button1 to perform click? What keys you want to use to enable this shortcut? the control button and P? If, yes the try this:

    Code:
    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyData = Keys.Control And e.KeyData = Keys.P Then
    Me.Button1.PerformClick()
    End If
    End Sub
    How can e.KeyData be equal to Keys.Control and equal to Keys.P at the same time? As has been established by post #3, you have to compare e.KeyData to (Keys.Control Or Keys.P), but this has already been explained to gautamshaw in their own thread on this topic, where they asked this exact same question.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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