• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2025 Replies
  • 331 Replies
    1928 Replies
Our minions are trying to make the site more secure by encasing the server in a cage made of solid SSL-ium which may throw up some issues when using the site for the next few hours. Bear with us while we weld this thing together and we are sorry for any inconvenience this may cause.

keycode?

Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
User avatar
Dummy1912
VIP - Donator
Posts: 1953

keycode?

Sat Mar 17, 2018 9:03 am

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

User avatar
CodenStuff
Site Admin
Posts: 4359

Re: keycode?

Sat Mar 17, 2018 3:26 pm

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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.


User avatar
Dummy1912
VIP - Donator
Posts: 1953

Re: keycode?

Sun Mar 25, 2018 9:37 am

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??

User avatar
CodenStuff
Site Admin
Posts: 4359

Re: keycode?

Sun Mar 25, 2018 1:23 pm

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?
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.


Post Reply

Return to “Coding Help & Support”