473,685 Members | 2,514 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PictureBox

This should be simple, when I use the code:
PictureBox1.Ima ge = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel
Nov 20 '05 #1
18 3063
Try this:

PictureBox1.Ima ge = Nothing

It will clear the image.

Sueffel wrote:
This should be simple, when I use the code:
PictureBox1.Ima ge = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel

Nov 20 '05 #2
Try this:

PictureBox1.Ima ge = Nothing

It will clear the image.

Sueffel wrote:
This should be simple, when I use the code:
PictureBox1.Ima ge = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel

Nov 20 '05 #3
That it will, I agree. It is also the first I tried incidently, but,
windows still has the file in use until I shut down the program. It has to
be the picturebox, nothing else is messing with that image, and if I don't
load it, things are fine. I suspect it may have something to do with the
dreaded GC (I'm finding more and more reasons not to like it), but I'm not
an expert.

Thanks,
Sueffel

"yEaH rIgHt" <no******@haha. com> wrote in message
news:10******** *****@corp.supe rnews.com...
Try this:

PictureBox1.Ima ge = Nothing

It will clear the image.

Sueffel wrote:
This should be simple, when I use the code:
PictureBox1.Ima ge = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel

Nov 20 '05 #4
That it will, I agree. It is also the first I tried incidently, but,
windows still has the file in use until I shut down the program. It has to
be the picturebox, nothing else is messing with that image, and if I don't
load it, things are fine. I suspect it may have something to do with the
dreaded GC (I'm finding more and more reasons not to like it), but I'm not
an expert.

Thanks,
Sueffel

"yEaH rIgHt" <no******@haha. com> wrote in message
news:10******** *****@corp.supe rnews.com...
Try this:

PictureBox1.Ima ge = Nothing

It will clear the image.

Sueffel wrote:
This should be simple, when I use the code:
PictureBox1.Ima ge = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel

Nov 20 '05 #5

I had a similar problem with a bitmap and I solved it this way:
Dim bm as New Bitmap("C\Temp\ Pic.bmp")

Picture1.Image = bm

bm = Nothing
Then try setting the PictureBox1 to Nothing. This will work.

Sueffel wrote:
That it will, I agree. It is also the first I tried incidently, but,
windows still has the file in use until I shut down the program. It has to
be the picturebox, nothing else is messing with that image, and if I don't
load it, things are fine. I suspect it may have something to do with the
dreaded GC (I'm finding more and more reasons not to like it), but I'm not
an expert.

Thanks,
Sueffel

"yEaH rIgHt" <no******@haha. com> wrote in message
news:10******** *****@corp.supe rnews.com...
Try this:

PictureBox1.I mage = Nothing

It will clear the image.

Sueffel wrote:
This should be simple, when I use the code:
PictureBox1. Image = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel


Nov 20 '05 #6

I had a similar problem with a bitmap and I solved it this way:
Dim bm as New Bitmap("C\Temp\ Pic.bmp")

Picture1.Image = bm

bm = Nothing
Then try setting the PictureBox1 to Nothing. This will work.

Sueffel wrote:
That it will, I agree. It is also the first I tried incidently, but,
windows still has the file in use until I shut down the program. It has to
be the picturebox, nothing else is messing with that image, and if I don't
load it, things are fine. I suspect it may have something to do with the
dreaded GC (I'm finding more and more reasons not to like it), but I'm not
an expert.

Thanks,
Sueffel

"yEaH rIgHt" <no******@haha. com> wrote in message
news:10******** *****@corp.supe rnews.com...
Try this:

PictureBox1.I mage = Nothing

It will clear the image.

Sueffel wrote:
This should be simple, when I use the code:
PictureBox1. Image = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel


Nov 20 '05 #7
Cor
Hi Sueffel and yEaH rIgHt,

I think that is the right solution, however as Herfried than always answers
when he sees that in this messages.

not
bm = Nothing

but
bm.dispose

With the connection is this one of the rare situations it should always be
used it seems.

Cor
Nov 20 '05 #8
Cor
Hi Sueffel and yEaH rIgHt,

I think that is the right solution, however as Herfried than always answers
when he sees that in this messages.

not
bm = Nothing

but
bm.dispose

With the connection is this one of the rare situations it should always be
used it seems.

Cor
Nov 20 '05 #9
Yeah, I forgot to add the bm.Dispose part
This should be simple, when I use the code:
PictureBox1.Ima ge = Image.FromFile( "MyPic.jpg" )

how do I "unload" it so I can move or delete it?

Thanks yet agian,
Sueffel

Nov 20 '05 #10

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

Similar topics

0
1647
by: SamSpade | last post by:
I have a usercontrol that contains a picturebox. The user can obtain (creategraphics) a picturebox graphics object and draw on the picturebox. She could do gr.GraphincInit.Millimeter and then draw using millimeters as the measurement. But he would still have to dimension the Picture box using pixels (Clientsize for example). He changes the picture box dimensions via usercontrol properties so I could scale them going in and out. Couple...
0
3879
by: akh | last post by:
I want to use de Drag and Drop ´s event to move a picture box from a form and within a Picture Box. But I have behaviour if the MyPBox As PictureBox as the Globale varible or not Thanks for your help, Here is the code.
3
63417
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and display (in the status bar) the image coordinates of the mouse location. However, if I use the picturebox's MouseMove event, I am getting the coordinates of the mouse over the PICTUREBOX, not the actual image underneath that (which is stretched)....
2
6150
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for loading images into the picturebox. If you double click the file you want to open in the open file dialog, it somehow interperets one of the clicks as a mouseup on the picturebox and fires the mouseup event for the picturebox. How can I get...
4
13439
by: Jerry West | last post by:
I have a routine that updates a PictureBox image every x seconds. I do this by first loading an array with the path to all of the images. I then generate a random number to use as the index of the array. A timer is set to update the PictureBox. This works great the first time through but fails on all subsequent Timer events. If I simply step through the code it works fine. If I run it only the first time through does the PictureBox update...
4
3814
by: munibe | last post by:
Hi, i have a problem about picturebox control. if you may help me, i will be so happy. i have a picturebox named pic_map, and i added a button named customer_button, my wish is to add a new small picturebox on the map_picture and the new added picturebox should have click event to get the location of it when it is clicked. i have written some code in C# but when clicking the small picturebox it just gets the location of the last added one,...
3
5366
by: kirk | last post by:
I have a form with a PictureBox control on it. The .Image property is set to a PNG file(which shows the picture of the US map) with some transparency in it. The .BackColor property is set to Transparent. This so far, works perfect. I now, would like to put another PNG image(an arrow showing positioning on the map) over the last PictureBox. The problem i'm having, the background for this second PictureBox only stays transparent when...
4
3711
by: Jim McGivney | last post by:
In C# on Form1 I genetate an array of PictureBoxes and populate each with an image as seen in the code below. Later on I want to access a specific PictureBox to change its image, but I keep getting the error "The name 'PictureBox1' does not exist in the current context" The code I use to try to access the PictureBox is "PictureBox1.Image = HoldBitMap; " where kount is an integer. I know the answer is probably in using the Controls...
5
5377
by: AWW | last post by:
XP VB 2005 running an example from help that creates a picturebox in code - the picturebox is not created. If I comment out the "Dim Box as New PictureBox" and create it in Design mode - the example works. I have tried Show, Enabled, Visible, and even BackColor. Why does a help example not work? and why does Design creation work? Thanks - I hope.
1
6496
by: leshka82 | last post by:
I have recently designed a Winform Image drag & drop utility. The approach I took was to have a Panel control serve as a destination for multiple file drop. Once the user dragged & dropped the desired files I do a check to ensure that I only process the image files (".jpg", ".png", etc), while any other files are ignored by the program. For every image file being dropped I programmatically create a PictureBox control, do proper resizing of an...
0
8577
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8763
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6436
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2199
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.