Page 1 of 1

keycode?

Posted: Sat Mar 17, 2018 8:03 am
by Dummy1912
Hello,

Love the new look codenstuff :D

i want to access Control + Alt + F1

but can't manage it

only works for 2 keycode noet 3 :(

any help please?

]code]
'Help
If (e.KeyCode = Keys.F1 AndAlso e.Modifiers = Keys.Control) Then
MsgBox("Ctrl+F1 for Help")
End If
'About
If (e.KeyCode = Keys.F1 AndAlso e.Modifiers = Keys.Control AndAlso e.Alt) Then
MsgBox("Ctrl+Alt+F1 for Help")
End If
[/code]

Search on Google but didn't find the solution

Thanks

Re: keycode?

Posted: Sat Mar 17, 2018 2:26 pm
by CodenStuff
Try:
Code: Select all
    Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
        If e.Control And e.Alt And e.KeyCode = Keys.F1 Then
            MsgBox("Ctrl+Alt+F1 for Help")
        End If

    End Sub

Re: keycode?

Posted: Sat Mar 17, 2018 3:13 pm
by Dummy1912
:teary; not working

Re: keycode?

Posted: Sun Mar 25, 2018 8:37 am
by Dummy1912
seems weird, but when we use a character with control and alt it works fine
but when we use it with f1 its not working :duh;
Code: Select all
If e.Control And e.Alt And e.KeyCode = Keys.F1 Then
            MsgBox("Ctrl+Alt+F1 for Help") ' not working
        End If
Code: Select all
If e.Control And e.Alt And e.KeyCode = Keys.G Then
            MsgBox("Ctrl+Alt+G for Help") ' working  :darnit; 
        End If
do someone has a clue??

Re: keycode?

Posted: Sun Mar 25, 2018 12:23 pm
by CodenStuff
I'm not sure why it's not working for you but the code I posted works fine for me.

Are you capturing keys anywhere else within your application?

Re: keycode?

Posted: Sun Mar 25, 2018 12:32 pm
by Dummy1912
no, just on the main form.