Click here to Skip to main content
15,897,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I user HelpRequested event to handle help. It works fine with F1 key, but it also works with Shift F1, I want to stop Shift F1.

What I have tried:

Private Sub KGMERP_HelpRequested(sender As Object, hlpevent As HelpEventArgs) Handles me.HelpRequested

Try

Process.Start("https://youtu.be/oXz5Cg9T6cw")

Catch ex As Exception
msgbox(ex)
End Try

End Sub
Posted
Updated 15-Nov-17 13:31pm

1 solution

VB
Private ShiftDown As Boolean
Private Sub Form1_HelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) Handles Me.HelpRequested
    If ShiftDown = False Then
        hlpevent.Handled = True
        MsgBox("Hello World")
    End If
End Sub

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    ShiftDown = e.Shift
End Sub

Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
    ShiftDown = False
End Sub
 
Share this answer
 
Comments
kgmmurugesh 16-Nov-17 8:30am    
Thanks
kgmmurugesh 20-Nov-17 2:10am    
This is better.

if My.Computer.Keyboard.ShiftKeyDown then
exit sub
endif

hlpevent.Handled = True
MsgBox("Hello World")

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900