If GetAsyncKeyState Keys.F1
Then
'code here'
Else
'something else'
Put it in a timer, preferably a delay between 100-200 ms. (if you make it too low, it will register the key being pressed x times instead of 1, if you put it too high, it won't register the key press all that often)