Rashid Khan

Rashid Khan

  • NA
  • 159
  • 0

How to delete Image form Folder which shown in picture box?

Mar 1 2017 7:13 AM
I have form where I can select Data to edit or delete. and picture shown on the form in picture box . trying to delete image so that user can upload new image. All time getting 
The process cannot access the file '.....\601.jpg' because it is being used by another process. 
tired so far: Image object set dispose on delete button. PictureBox set null.
try to closed the file but same issue
FileStream oFileStreamDec = new FileStream(imgpath, FileMode.Open, FileAccess.ReadWrite, FileShare.Delete);
oFileStreamDec.Close();
 
sometime it delete file don;t know how but mostly giving error 
can someone please helpme out from this
may be i m not clear in my word but please help 

Answers (4)