In a Windows form application, some image files are assigned to PictureBox controls. I am trying to delete those image files. The first approach  with "Image.FromFile" gives an error message of "Another process is using this image file", although "Image.Dispose()"
is executed. The second approach  using "Image.FromStream" results (X) images for PictureBoxes and Buttons, if "fs.Close()" is inclided. Without "fs.Close()", it gives the same error message of "Another process is using...". How can I display images properly
and delete those images files ?
pictureBoxSelected.Image = Image.FromFile(@actualImage);
pictureBoxSelected.Image = Image.FromFile(@tempImage);
if (System.IO.File.Exists(actualImage) == true)
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
pictureBox.Image = System.Drawing.Image.FromStream(fs);
View Complete Post