tags:

views:

81

answers:

4

I have Winforms insight have one picture box. When I double click, my logic writes (using stream class) a picture and then stores one in the system folder. When I am trying to write, I get an error like "can't access file; it's being processed by another process".

How can I overcome this problem?

A: 

A few tips:

  1. Restart your machine, see whether it still has the same problem.
  2. Try to disable the previous write in your code, see whether it is the previous writes that locks the file resources.
Ngu Soon Hui
+1  A: 

Make sure to close your stream after each write.

Mez
A: 

Does it happen when you write the first or the second time? If it's the second time, you have probably forgotten to dispose or close something. If you have loaded an image from that file, you must dispose the image before you can write to its file, sine an image ownd the stream it was loaded from.

danbystrom
A: 

System folder? Trying to overrite a system file (most likely to be write-locked)?

Sorin Comanescu