I have an app (C# .NET Studio 2003) that:
1-unzips a user selected compressed folder to a sub folder that i create
2-renames and copies the files
3-prints any selected in a checkedlistbox
4-removes the temp folder on exit
This works fine unless there is a System.Exception error from printing - like printer not available. I catch the exception, tell the user waht happened, and try to exit gracefully. But, when I use "directory.delete", I get an IOException that the file is in use - the file that generated the print exception. I dispose of all lists & clear all arrays. I see the name of the file in the IOException message but don't have access to it & it could be anything. All variables that reference the filename are gone. I will try to loop through all files and delete them but I expect the same error.
I know the file is not in use except for the System.Exception error. How do I make sure the file is free to delete?