Displaying an Image Without Locking its File

added by amgadhs
7/20/2010 4:18:50 PM

1 Kicks, 59 Views

The PictureBox control is one of the most used controls in Windows Forms applications. And sometimes you might want to delete the image file that is displayed on it. Doing so with an image displayed using the Image.FromFile function will result in a file locked exception. And file will stay locked until the program exits, even if you set the variable to null.