Button1_Click Change image in PictureBox1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can i make a button click change an image in a picture box? I basically
have an image in my main Form, i want it to change when a button is clicked.

--
<XML>
<BEGIN:: DCSE-TRAINING>
<END:: DCSE-TRAINING>
<BEGIN:: GOOD-CAREER>
<BEGIN:: GOOD-CAREER>
<I SAID BEGIN:: GOOD-CAREER>
<BEGIN:: METHOD:: GIVE-UP>
</XML>
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
PictureBox1.Image = New
System.Drawing.Bitmap("C:\windows\mypicture.bmp")
End Sub

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
NeverwaY said:
How can i make a button click change an image in a picture box? I
basically
have an image in my main Form, i want it to change when a button is
clicked.

\\\
Dim OldImage As Image = Me.PictureBox1.Image
Me.PictureBox1.Image = Image.FromFile("C:\foo.bmp")
OldImage.Dispose()
///
 
Thanks tons, fellows! Now...is there any way to load a file from within the
project? ie: not from an external source?
--
<XML>
<BEGIN:: DCSE-TRAINING>
<END:: DCSE-TRAINING>
<BEGIN:: GOOD-CAREER>
<BEGIN:: GOOD-CAREER>
<I SAID BEGIN:: GOOD-CAREER>
<BEGIN:: METHOD:: GIVE-UP>
</XML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top