PictureBox with shortcut possible?

M

Mika M

My Windows Form (VB2005) contains PictureBox on it. This PictureBox has
click-event in use to do something. Now I need to know Is it possible to
set Shortcut for this PictureBox? I mean if user clicks for example "F2"
then it fires PictureBox_Click-event.
 
N

neeraj

hi Mika

There is no way to be trace key press event with picture box but we
can handle it by another method.

You can do it by this method

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
MessageBox.Show("Hello")
End Sub

Private Sub Form5_KeyUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
If e.KeyCode.F2 Then
PictureBox1_Click(sender, e)
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top