Home All Groups Group Topic Archive Search About

PictureBox with shortcut possible?

Author
18 May 2006 12:13 PM
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.

--
Thanks in advance!

Mika

Author
19 May 2006 5:36 AM
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