Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27243

VS 2010 [RESOLVED] shortcut key for button

$
0
0
hello,
i am trying to use a shortcut key for a button and below is the code i am using.
Code:

Private Sub btnNew_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles btnNew.KeyDown
        If e.KeyCode = Keys.F2 Then
            btnNew.PerformClick()
        End If
    End Sub

the thing is it is working only after i pressed the button once. when i run the application and click F2, it does not work. i have to click on the button once and then the shortcut key works. is that normal?
please advise.
thanks

Viewing all articles
Browse latest Browse all 27243

Trending Articles