Question: I am currently coding a C# application that displays a image using PictureBox on a form.

Now, I want to update this image consistently (e.g. every 2 seconds). But I am not able to do this.

Because the new image is also of the same file directory/name and it will be replacing the original image which is loaded. So when I want to replace the image it is showing, "file is being used by another program...etc)."

Basically, I want to use PictureBox to load an image and this image will be consistently updated as the loaded image is being changed at it's directory.

Is this possible? Is there any other way to do this in C#?

Thanks In Advance,
Perumal

Answer: 
It sounds as if a stream isn't closed. Try to call `stream.close();` after you have loaded your image. If you are loading your image like this `Image i = new Image(File.Open("blub.png"));` Then you will have to rewrite it a bit like this;

```
FileStream fs = File.Open("blub.png");
Image img = new Image(fs);
fs.Close();
fs.Dispose();

```
My best solution for you is to use the executable file, it's called Volume Shadow Copy. This actually is used in windows for backup as it allow you to copy files that are being used. I have actually tried this tool without C# code but it will be easy to use in code.

Here is a link: <http://www.howtogeek.com/howto/windows-vista/backupcopy-files-that-are-in-use-or-locked-in-windows/>

My idea is to make a copy of the file with another name and access that file and the delete after you next load, i see that to be the best approach for you.