Loading Image in PictureBox

  • Thread starter Thread starter Mario
  • Start date Start date
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,
 
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.
 
Back
Top