-
KeyDown Event
What am I doing wrong?
I want to enable a "help" form when a user presses F1.
My Code:
Code:
Private Sub frmMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Dim HelpForm As New frmHelp()
If e.KeyCode = Keys.F1 Then
HelpForm.ShowDialog()
End If
End Sub
What happens is if a user hits F1 then the form will show... BUT if the user hits [x] (form is closed) and you return to the main form and hit F1 - nothing happens...??
Thanks..
Anjari
-
Set the KeyPreview property of the main form to True.