I have a winform program where I am trying to include PF functionality in tandem with button/mouse-click functionality. On the first screen that opens in the application, the keyup event works. I changed the KeyPreview property to True and wrote the following code:
Private Sub Vehicle_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.F1 Then
CarrierOn = True
Call Display_CarrierDetail_Screen()
ElseIf e.KeyCode = Keys.F9 Then
Call Display_History_Screen()
ElseIf e.KeyCode = Keys.F6 Then
Call Display_County_Screen()
ElseIf e.KeyCode = Keys.F5 Then
Call Instant_Observation("Vehicle")
End If
End Sub
The above works.
However, on opening the second form, I wrote very similar code, also changed that form's keypreview property to True, and tested the PF key - nothing happens.
Why would it work on the first form, but not on the second? The second does have the focus when I am pressing the PF key.
Thank you, laurie