Unable to delete image file

Posted by Admin on 07-Jul-2010 09:34

I am using UltraPictureBox to load the image for each record, but I can't delete the file that is recently created. I get OS-ERROR #2 or #999 when I try to use OS-DELETE . All the image files are locked. I have to close the application to delete those files. Please help.

picturebox.image =  System.Drawing.Image:FromFile(FileName).

OS-DELETE

VALUE(FileName) .

All Replies

Posted by Wouter Dupré on 07-Jul-2010 09:39

Hi, I'm out of the office for business. During my absence I will have no or limited access to my e-mail.

For immediate assistance please call our office at +32 (0) 15 30 77 00.

Best regards,

Wouter.

--

Wouter Dupré

Senior Solution Consultant

Progress Software NV

Stocletlaan 202 B| B-2570 Duffel | Belgium

Direct Line +32 (0) 15 30 77 00 | Mobile +32 (0) 478 50 00 49

wdupre@progress.com

Posted by Admin on 09-Jul-2010 00:46

The image files you are trying to delete are locked by your application. If you really want to delete them after displaying them, you could read the file using a stream, like this:

fileStream = new System.Io.FileStream(fileName, System.IO.FileMode:Open, System.Io.FileAccess:Read).

pictureBox:Image = System.Drawing.Image:FromStream(fileStream).

fileStream:Close().

os-delete value(fileName).

Hope it helps.

Posted by Admin on 09-Jul-2010 07:24

thanks. appreciate it. It works.

Thanks,

Cathy Weng

This thread is closed