picturebox keypress?

seanvoth

Well-known member
Joined
Aug 5, 2006
Messages
58
Programming Experience
1-3
i have a pic prob can you have a key press in a pic
 
of course. There are multiple ways to do this. In code view, select the picturebox in the left drop down and keypress in the right, double click on the picturbox in form view and it will automatically create the code for you, or input the following into your code
VB.NET:
 Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub
of course the previous code will need to be modified based on the name of your picture box. These type of problems can usually be solved just by getting to know the VB.net better, make sure you try to find the solution yourself before you ask here, okay?
 
No, Picturebox doesn't have Keyboard events.

You can perhaps use the Keyboard events of Form itself, you have to set KeyPreview property of form True to read them regardless of which control has focus.
 
as far as i'm aware, if a control cannot have the focus, it doesnt receive key events..

you can, in addition to johns way, fake it with a textbox that is visible=true but hidden off screen (.Location = -500,-500)

when the textbox has the focus you can alter the border of the picturebox, and whatever key events the textbox receives, you can make the picturebox do whatever..
 
Back
Top