How to replace or delete the image that has been used by another process previously u

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sakthi Manoj R
    New Member
    • Apr 2012
    • 1

    How to replace or delete the image that has been used by another process previously u

    Hi,
    I'm using web cam to save,update the image in base directory folder.I can save the image but, while attempting to update the image..I caught an error!!

    C#.Net:
    The process cannot access the file 'C:\..~..\bin\D ebug\customer_p hotos\10.jpg' because it is being used by another process.

    ..?
    Thanks in advance..
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    You have not posted the code concerned, but the error message is indicating that whatever process you are using to save the file the process has not been cleanly completed. You may still have an object or other variable linked to that file which is still in scope resulting in Windows being unable to release the 'in-use' lock placed on the file during the copy. Can't really say any more without seeing the code.

    -Stewart

    Comment

    • RhysW
      New Member
      • Mar 2012
      • 70

      #3
      I faced this problem a lot when I was trying to create and then overwrite the contents of a text file, I had forgotten to do tw.close(); when I created it initially so the text-writer was permanently linked to the file holding it open, so step one would be sure you closed off the creators, even if it isn't the problem its good practice and saves on resources! but as posted above some code would be useful for a better diagnosis

      Comment

      Working...