Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you release a file from an application

Status
Not open for further replies.

faust13

Programmer
Aug 7, 2001
176
US
How do you release a file from an application? I have an application that uses a image to populate a picturebox. After the image is poplated, I need to delete the populating file. When I do this, it errors out saying that the file is still in use.

I've disposed the picturebox before trying to delete, but it still gives this error. Is there a way to explicitly command VB .Net to release a file?

Cheers! --------------------------------------
Is George Lucas Kidding...
Noise Core: 7.62
 
faust,

Have you closed the file using the Close method? Until you have or the garbage collector runs, the file is in use....

Craig
 
I'm using Image.FromFile(), System.IO.path.GetFileName(), System.IO.File.copy(), System.IO.path.move(), they don't require closing, because they're not streams right?

Thanks. --------------------------------------
Is George Lucas Kidding...
Noise Core: 7.62
 
I also am doing this and was having a problem. After I was done with the picture i did this, and it allowed it.

picturebox.image = nothing
picturebox.image.dispose()
Kill(filname)


This worked for me, hope it helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top