473,320 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Button1_Click Change image in PictureBox1

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>
Nov 21 '05 #1
3 11921
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" <ne******@hotmail.com> escribió en el mensaje
news:D4**********************************@microsof t.com...
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.

Nov 21 '05 #2
"NeverwaY" <ne******@hotmail.com> schrieb:
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()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
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>
"Herfried K. Wagner [MVP]" wrote:
"NeverwaY" <ne******@hotmail.com> schrieb:
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()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bill N. | last post by:
Using VB .Net 2003 Standard Edition. This simple form has a "File in Use" problem while the executable is running. Created this simple program to make sure that I hadn't done something in my...
3
by: Li Weng | last post by:
Hi, I have a form with a picturebox. I added an image in picturebox at design time. I create the form in codes with New and .Show() to pop up. But image doesn't show up. The picturebox looks...
0
by: jez | last post by:
I'm programming in C# for a PPC, and trying to display an image from the start, i.e. as soon as the program launches. I've tried (as explained in Microsoft's .NET Compact Framework book) to use two...
4
by: MAY | last post by:
Hi, I drew some lines on a form and i want convert these lines into a bitmap. How can i do that? MAY
1
by: Novice | last post by:
I'm afraid I will incur the wraith of Mr. Powell on this one - but I did read his #1 FAQ and some others and I still can't figure this out. I created this little c# app. and I have a PictureBox...
6
by: Patrick Dugan | last post by:
Hello, I'm trying to load different images (icons) into a PictureBox1.Image. The first image loads just fine, but the second image always returns the error "Invalid property used." It doesn't...
0
by: Deepak C.G via .NET 247 | last post by:
I want to dispose the image object in my child form, unless I won't dispose this object i can't delete the image file in my folder. I get this error in MDIparent form "An unhandled exception...
4
by: Charles | last post by:
Hello Everyone, I have been gettting great feedback from microsoft.public.vc.language group but after doing more searching I think my post should be directed to this group. I am trying to make...
3
by: martins | last post by:
Hi, Is there a way in VB.NET to get a JPEG Image Information ? like dimensions (Width x Height)...etc.. Thanks in advance
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.