472,330 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

PictureBox

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 #1
18 2934
Try this:

PictureBox1.Image = 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 #2
Try this:

PictureBox1.Image = 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 #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.supernews.com...
Try this:

PictureBox1.Image = 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 #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.supernews.com...
Try this:

PictureBox1.Image = 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 #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.supernews.com...
Try this:

PictureBox1.Image = 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.supernews.com...
Try this:

PictureBox1.Image = 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.Image = Image.FromFile("MyPic.jpg")

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

Thanks yet agian,
Sueffel

Nov 20 '05 #10
Yeah, I forgot to add the bm.Dispose part
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 #11
This does not work, I get a funky red X in the picturebox. So, I still have
the problem of, untill my app exits, I can't do anything with these images,
which is not acceptable. I need to be able to show the user the jpg in the
picturebox, ask them a question, then move/delete it at will.

Thanks,
Sueffel
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...

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.supernews.com...
Try this:

PictureBox1.Image = 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 #12
This does not work, I get a funky red X in the picturebox. So, I still have
the problem of, untill my app exits, I can't do anything with these images,
which is not acceptable. I need to be able to show the user the jpg in the
picturebox, ask them a question, then move/delete it at will.

Thanks,
Sueffel
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...

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.supernews.com...
Try this:

PictureBox1.Image = 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 #13
I came up with a workaround. I created an ImageArray, and loaded each image
in there, then, I disposed each member, then zeroed the array. Works like a
charm.

Thanks again,
Sueffel

"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...

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.supernews.com...
Try this:

PictureBox1.Image = 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 #14
I came up with a workaround. I created an ImageArray, and loaded each image
in there, then, I disposed each member, then zeroed the array. Works like a
charm.

Thanks again,
Sueffel

"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...

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.supernews.com...
Try this:

PictureBox1.Image = 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 #15
Cor
Hi Sueffel,

I had it not direct in my personal cache memory.

I was looking for a solution for you, and therefore I am glad you did send
this message.

Cor
Nov 20 '05 #16
Cor
Hi Sueffel,

I had it not direct in my personal cache memory.

I was looking for a solution for you, and therefore I am glad you did send
this message.

Cor
Nov 20 '05 #17
The only thing I have to add to my last post was I also had to force
GC.Collect. I'm really starting to dispise the GC in all it's insane
wonders.... And now it looks SP2 for WinXP will have it SystemWide! All I
can say is Ohh My God!

Sueffel
"Cor" <no*@non.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
Hi Sueffel,

I had it not direct in my personal cache memory.

I was looking for a solution for you, and therefore I am glad you did send
this message.

Cor

Nov 20 '05 #18
The only thing I have to add to my last post was I also had to force
GC.Collect. I'm really starting to dispise the GC in all it's insane
wonders.... And now it looks SP2 for WinXP will have it SystemWide! All I
can say is Ohh My God!

Sueffel
"Cor" <no*@non.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
Hi Sueffel,

I had it not direct in my personal cache memory.

I was looking for a solution for you, and therefore I am glad you did send
this message.

Cor

Nov 20 '05 #19

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

Similar topics

0
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...
0
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...
3
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...
2
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...
4
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...
4
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...
3
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...
4
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...
5
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...
1
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.