Loading Image in PictureBox

M

Mario

Hi,
I'm developing a application for my IPAQ in c#.

My problem is: I have a pictureBox on the principal form and in the code i
load differents images from a Imagelist.

pictureBox1.Image.Dispose();
pictureBox1.Image = ImageList.Image[0];

When this succed the picturebox get blank (or null image) appareance.

What happens with my code?

Thanks,
 
A

Alex Feinman [MVP]

What was the previous image in the image list? If you do this twice

pictureBox1.Image.Dispose();
pictureBox1.Image = ImageList.Image[0];

then the second time, the ImageList.Image[0] will be disposed of. Remember
that Image is a reference type.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top