2
Answers

Access to file used in picturebox

Ask a question
Cam

Cam

16y
6.6k
1

I've got a form in a MDI project that contains a picturebox control.  I populate the control like this...

newimage = Image.FromFile("c:\temp.bmp")
Me.PictureBox1.Image = newimage

I need to later kill the file "c:\temp.bmp", but even after executing the dispose method of the picturebox control I get the error "The process cannot access the file 'c:\temp.bmp' because it is being used by another process."  What am I missing here? 

Any help would be greatly appreciated. 

Thanks,
Cam


Answers (2)