469,282 Members | 1,965 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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 2778
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by SamSpade | last post: by
reply views Thread by akh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.