Hi
I am create one application in which add some selected images into flowlayoutpanel but how to remove memory assigned to particular images in flowlayoutpanel

It give some error like this
(the process can not access the file "C:\Images\xyz.jpg" because it is being used by another process)

Hi,

are you studying the same course as Vidya? You have both posted the same problem twice now :)

Its usually best to see if someone has a similar problem before you post your own...that way replies and all relevent code are kept in one place.

Heres what i told Vidya:

had a quick search around the Micrsoft Support site, if you use FromFile in code to set an image file to a picturebox it locks the file. You can avoid this by using a filestream to retrieve the image:

System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);            PictureBox1.Image = System.Drawing.Image.FromStream(fs);            fs.Close();            System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            PictureBox1.Image = System.Drawing.Image.FromStream(fs);
            fs.Close();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.