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

VS 2008 [RESOLVED]Hotkey to turn on and off with same key

$
0
0
Hi !
I have a problem with creating a hotkey (GetAsyncKeyState) that will turn timer on with F1 button and turn it off with same button.
I finally did it,however after i press F1 to turn it off, i cant turn it on anymore..
My hotkey timer codE:
Code:

Private Sub hotkey_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hotkey.Tick
        Dim mykey As Boolean
        mykey = GetAsyncKeyState(Keys.F1)
        If mykey = True Then
            Timer1.Enabled = True
            If turnedON = True Then Timer1.Enabled = False
        End If
    End Sub

Could someone fix this, so after i press F1 to turn off the timer, i will be still able to turn it on with pressing F1 again?

Viewing all articles
Browse latest Browse all 27186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>