Hi Paul, welcome to VBForums.
The ZoomPictureBox allows you to set the Image to Nothing and to call its Invalidate method in much the same way as a PictureBox. In both cases, the image source file remains locked. The safest way to avoid this is to read the image as a Stream instead of opening it with Image.FromFile(filename) or New Bitmap(filename).
The source file is closed at the end of the Using block, so you are free to delete it independently of the image.Code:Using stream As IO.Stream = IO.File.OpenRead(filename) ZoomPictureBoxName.Image = Image.FromStream(stream) End Using
BB




Reply With Quote