1

I have a code that should start a timer when a key is pressed

code :

Private Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Integer) As Integer

Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
    If GetKeyPress(Keys.LControlKey)  Then
        Timer1.Start()
    ElseIf GetKeyPress(Keys.LShiftKey) Then
        MsgBox("test")
    End If
End Sub

The problem here is whem i press left control timer1 starts and the message box appears also without clicking left shift. Help please.

Omar Hafz
  • 11
  • 5

0 Answers0