Make a button click change a picture in the picture box visual basic

picturebox, vb.net, visual-studio-2010

Solution

if you use VBA like you tagged your question (before edit)... then try this.

Private Sub button1_Click()
    picture1.Picture = "C:\1.jpg"
End Sub

Private Sub button2_Click()
 picture1.Picture = "C:\2.jpg"
End Sub

if its vb.net (which i indicate because you said visual studio 2010 express) try this

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    PictureBox1.Image = Image.FromFile("C:\1.jpg")
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    PictureBox1.Image = Image.FromFile("C:\2.jpg")
End Sub

exception handling is up to you :)

Problem

I have one picture box and multiple buttons on Visual Basic 2010 Express. I'm looking for an example code for putting a picture in the box when I click the button and it changing when I click another button.

Original source