473,322 Members | 1,232 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,322 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 3032
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 could do gr.GraphincInit.Millimeter and then draw...
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 PictureBox as the Globale varible or not Thanks for...
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 moves the mouse over the form, I want to get and...
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 mouseup event. I also have an open file dialog for...
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 generate a random number to use as the index of the...
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 customer_button, my wish is to add a new small...
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 transparency in it. The .BackColor property is set to...
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 PictureBox to change its image, but I keep...
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 PictureBox" and create it in Design mode - the...
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 file drop. Once the user dragged & dropped the...
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...
0
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.