Hello,
I want to display a preview of an image on my form. I've been trying to do this with a PictureBox control, but have repeatedly run into the same problem.
The following code will draw the image I want (FYI sublayout is a proprietary API object that stores an image layout, and prev_pcbx is a PictureBox):
-snip-
Dim tempImage As Image
subLay.LayoutToFile(GenPath & "preview.bmp")
Prev_pcbx.Image = tempImage.FromFile(GenPath & "preview.bmp")
-snip-
However, when I run the same code again, I get a "preview.bmp is busy" message when subLay.LayoutToFile is called. I tried deleting the .bmp before this call, but then I get a message saying that the file is being used by another thread.
What can I do to remedy this issue?
Thanks in advance.
I want to display a preview of an image on my form. I've been trying to do this with a PictureBox control, but have repeatedly run into the same problem.
The following code will draw the image I want (FYI sublayout is a proprietary API object that stores an image layout, and prev_pcbx is a PictureBox):
-snip-
Dim tempImage As Image
subLay.LayoutToFile(GenPath & "preview.bmp")
Prev_pcbx.Image = tempImage.FromFile(GenPath & "preview.bmp")
-snip-
However, when I run the same code again, I get a "preview.bmp is busy" message when subLay.LayoutToFile is called. I tried deleting the .bmp before this call, but then I get a message saying that the file is being used by another thread.
What can I do to remedy this issue?
Thanks in advance.