When my form opens it uses the file path that is provided from another form and displays the images, and when I close the form I want it to delete all the images.
But when I close it keeps stating the file is being used, is there a better way of doing it please?
public frmMark(string strImagePath)
{
InitializeComponent();
pbImage1.Image = new Bitmap(strImagePath + "1.jpg");
pbImage2.Image = new Bitmap(strImagePath + "2.jpg");
pbImage3.Image = new Bitmap(strImagePath + "3.jpg");
}
private void frmMark_FormClosing(object sender, FormClosingEventArgs e)
{
File.Delete(deletepath + "1.jpg");
}