Hi, there may be two issues: 1. Most ways to load an image keep the image file open as long as the Image object is not Disposed() off. The only exception I am aware of is when reading an image through Image.FromStream() Remedy: use FromStream() or make sure you call Dispose(). remark: I don't think it is sufficient to Dispose() of a PictureBox if it is the only thing refering to the Image that got loaded from your file. 2. When a file, any file, is freshly written chances are some other utility is investigating it, prohibiting you from immediately renaming, deleting or overwriting it; candidate utilities are abything that works in the background on new files, such as file system indexers, and ativirus tools. Remedy: retry a couple of times, 1 second apart. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.