Make a button click change a picture in the picture box visual basic
97,630
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 :)
Author by
Nikita Zomer
Updated on March 08, 2020Comments
-
Nikita Zomer about 4 years
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.
-
Nikita Zomer about 11 yearsThank you very much!! Its vb.net I'm in computer science one in my high school I'm in 11th grade and computers have fascinated me since when I got a phoenix computer with windows 95.