One way is to set a boolean when a key is down and released, something like...
Code:Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick Static KeyIsDown As Boolean ' to detect if a key is already down (no repeats). Dim keyF3 As Short = GetAsyncKeyState(Keys.F3) If keyF3 < 0 Then if KeyIsDown = False then KeyIsDown = True ' set flag key is down. ' < Do something here > End If Else KeyIsDown = False ' reset key is down flag. End If End Sub




Reply With Quote