Link to home
Start Free TrialLog in
Avatar of gjok
gjokFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Create and Delete image

Hi,
I am working on a vb.net windows application. (windows 2000 / .net 1.1)

The application dynamically creates a picturebox and loads a picture into it from disk. Then after a couple of seconds the app needs to delete it.
However, when I try to delete the file I get this error:

An unhandled exception of type 'System.IO.IOException' occurred in microsoft.visualbasic.dll
Additional information: The process cannot access the file "C:\test.Png" because it is being used by another process.

But the only process that could be using it is the app itself.
I've also tried this to no avail:
    pic1.Image=Nothing
    Controls.Remove(pic1)
    Kill("C:\test.Png")

Any ideas...?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gjok

ASKER

Thanks that seems to have corrected the problem!

This may be related to a similar issue I have with the webbrowser control (AxSHDocVw.AXWebBrowser).
If you can help, please see:
https://www.experts-exchange.com/questions/21914977/Modify-file-displayed-in-AxSHDocVw-AXWebBrowser.html