The code, which does not react during Ctrl + Shift + H is pressed :
Private Sub HideMode(ByVal sendeer As System.Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
Select Case CInt(e.KeyCode)
Case Keys.ControlKey
If e.Shift AndAlso e.KeyValue = Convert.ToInt32(Convert.ToChar(Keys.H)) Then
MsgBox("Test hide function")
End If
End Select
End Sub
The expected result is that, after pressing Ctrl + Shift + H a msgbox will show with text "Test hide function"
What's the error in here?
I don't underdstand why you try to convert the KeyCode to an integer when the same work could be easily done using the Keys enum
Select Case e.KeyCode
Case Keys.H
If (e.Control AndAlso e.Shift) Then
MsgBox("Test hide function")
End If
End Select
EDIT Well, the WebBrowser control is a different beast. You need to add a specific KeyDown handler for it (in addition to the other one that handles the KeyDown when the Focus is on other controls)
Private Sub Browser_PreviewKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles WebBrowser1.PreviewKeyDown
Select Case e.KeyCode
Case Keys.H
If e.Shift AndAlso e.Control Then
MsgBox("Test hide function")
End If
End Select
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With