Hi,
I have created the following piece of code to try and see if the user pushes the 'f1' key, and if they do, a help box will open.
I am not sure if this code works yet because the keypressed event is not triggered when I push a key.
Could someone tell me how I can change my code so that it will test what key is pressed, no matter what control on the form has focus?
Thanks for your help
I have created the following piece of code to try and see if the user pushes the 'f1' key, and if they do, a help box will open.
VB.NET:
[SIZE="2"]Private Sub LoginForm_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
' If F1 key is pressed open help form
If (e.KeyChar.Equals(Keys.F1)) Then
' If 'Help' is clicked, show help form
Dim newLoginHelp As New LoginHelpForm
newLoginHelp.Show()
End If
End Sub[/SIZE]
I am not sure if this code works yet because the keypressed event is not triggered when I push a key.
Could someone tell me how I can change my code so that it will test what key is pressed, no matter what control on the form has focus?
Thanks for your help