?
Solved

Home Key as Shortcut Key for button

Posted on 2006-05-19
1
Medium Priority
?
250 Views
Last Modified: 2008-03-17

 Hi,
 
     In my VB.NET Application, I want to have Home key as Shortcut key for a button. How can I do this?

Thank you,
Sujanakar
0
Comment
Question by:LioElectronic
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 16718860
Try...

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.KeyPreview = True
    End Sub

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Home Then
            Button1.PerformClick()
        End If
    End Sub
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Six Sigma Control Plans
Progress

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question