I'm developing a VB.net windows application and i want it to operate using key press i.e. hotkeys. I want it to work when user press a key from keyboard e.g if P is pressed it should print like that. please help me to do this.
VB.Net Windows Application How to Set Hot Keys?
Hi friends,
VulpesPosted Apr 30, 2013, 1:03 PM
If you do this, then you can prevent the keystroke from going to the control at all by setting the KeyPreviewEventArg's Handled property to true.
For example:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.P Then
MessageBox.Show("P was pressed")
e.Handled = True
End If
End Sub
Javeed M ShaikhPosted Apr 30, 2013, 11:56 AM
http://windowscoding.com/blogs/blake/archive/2009/05/19/how-to-register-a-keyboard-shortcut-hot-key-in-a-net-windows-forms-application.aspx