The documentation provided by Microsoft is really very useful. Here's a quote from the help topic for the Image.FromFile method:
The file remains locked until the
Image object is disposed.
This means that you must either call Dispose on the Image object to release the file, which destroys the Image so it can not be used anymore, or else not lock the file in the first place by loading the image a different way. The .NET 2.0 PictureBox has a Load method that takes care of that but in previous versions this is your best bet: Code:
Dim file As New IO.FileStream("file path here", IO.FileMode.Open)
Me.PictureBox1.Image = Image.FromStream(file)
file.Close()
Bookmarks