when deleting files one by one error is generated as \"the process cannot access the file \' because it is being used by another process when trying to delete file\"
cod
You don't say specifically what file you're trying to delete, but from your question it sounds like you're trying to delete the image file that you loaded. If that's the case, then you have a problem. The documentation for Image.FromFile says:
The file remains locked until the Image is disposed.
If you need the ability to delete the file, you'll want to copy the image after you've loaded it, and use that image in your PictureBox. Then you can dispose the loaded image, thereby unlocking the file.