Hello,
I have made a custom button using a usercontrol and I have a problem. I want to add shortcuts to activate the button. The problem is that when I press the combination of keys, nothing happens. I have enabled key preview on the form where I have the usercontrol and I have also tried to run the code on my main form, where it functions just fine. Do you have any suggestions?
Thanks in advance!
Here is the code I used in the usercontrol:
Sub MyBase_KeyDown(sender As Object, e As KeyEventArgs)
If e.KeyData = ShortcutKeys Then
OnPictureBoxClick() 'This is basically the way I tell it to click and it works just fine'
End If
End Sub
Private Sub Custom_Button_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddHandler Me.Parent.KeyDown, AddressOf Me.MyBase_KeyDown
End Sub