I have been seeing a number of applications where the shortcuts for their buttons are just a single Alphanumeric key. I was just wondering if I could also do that in my applications.
My button labeled Open for example, will be triggered if the alphanumeric key "O" is pressed. Is this possible?

Hi,

Go to the properties of your button and use this text: &Open and this name: btnOpen
You will see in the designer the text appear in the button like this: Open

Now, try this part of code:

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        MsgBox("You used the shortcut key")
    End Sub

This will work if it is accompanied by the ALT key. What about without any of the CTRL, ALT or SHIFT keys?

Hi,

Before I posted this code I've tested it without any other key.
So, When you type "O" the Msgbox will be showing the message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.