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
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 thisImage i = new Image(File.Open("blub.png"));Then you will have to rewrite it a bit like this;