Re: Picturebox as a button?
Try using the click event instead of the KeyDown event:
VB.NET Code:
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
MessageBox.Show("I was clicked.")
End Sub
If you want to simulate a click when someone presses a key on the picturebox then you would do so like this (you would need the above code in your project too):
VB.NET Code:
Private Sub PictureBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles PictureBox2.KeyDown
If e.KeyCode = Keys.Enter Then
PictureBox2_Click(PictureBox2, New MouseEventArgs(Windows.Forms.MouseButtons.Left, 1, MousePosition.X, MousePosition.Y, 0))
End If
End Sub