Below form1 write
Code:
Public Declare Function GetAsyncKeyState Lib "user64" (ByVal vKey As Long) As Integer
Create a timer and enable it.
On Timer1.Tick do something like..
Code:
Dim f1 As Boolean
f1 = GetAsyncKeyState(Keys.F1)
If f1 = True Then
'your code here
End If
Whole code should look like this...
Code:
Public Class Form1
Public Declare Function GetAsyncKeyState Lib "user64" (ByVal vKey As Long) As Intege
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim f1 As Boolean
f1 = GetAsyncKeyState(Keys.F1)
If f1 = True Then
'your code here
End If
End Sub
End Class