So, heres the deal. I am writing a program and a portion of it takes a .hgl file and converts it to a .emf file and then loads it in a picture box, which is easy stuff. I then want to delete the original picture .emf as that sub gets called many times and will load many different pictures into that picture box so as to not have a bunch of un-needed files sitting around. I can't delete the file as the it is in use by the picture box, which makes sense. So I thought "hey, put it on the clipboard and then paste it from the clipboard to the picture box and then tada! Problem is, I have tried about 50 different ways to do this, and it will not work. I have tried googling it, but all the examples I find out there tell me I have to import like 14000 lines of code to do this, and it ought to be easier than that. As usual, the msdn library is useless as well, because it just says "clipboard.setimage" or "clipboard.getimage".
here is the code I have that works:
temp = ConvertHGLtoEMF(File_Name) 'temp is a string, the file path to the picture on the hard drive c:\Windows\temp\~020713153759.hgl
resize_picture_and_load_it(temp)
I have tried this, but I get an error
My.Computer.Clipboard.setimagePath(temp)
'setimagePath' is not a member of 'Microsoft.VisualBasic.MyServices.ClipboardProxy'. My.Computer.Clipboard.setimagePath(temp)
this gives an error too:
My.Computer.Clipboard.setimage(temp) 'temp is a string, the file path to the picture on the hard drive
Value of type 'String' cannot be converted to 'System.Drawing.Image'.
I even tried making a dataObject thinking I could use my temp string as the path to the picture for the pictureObject, but guess what, it didn't work.
Dim pictureObject As DataObject
pictureObject = New DataObject
here is the code I have that works:
temp = ConvertHGLtoEMF(File_Name) 'temp is a string, the file path to the picture on the hard drive c:\Windows\temp\~020713153759.hgl
resize_picture_and_load_it(temp)
I have tried this, but I get an error
My.Computer.Clipboard.setimagePath(temp)
'setimagePath' is not a member of 'Microsoft.VisualBasic.MyServices.ClipboardProxy'. My.Computer.Clipboard.setimagePath(temp)
this gives an error too:
My.Computer.Clipboard.setimage(temp) 'temp is a string, the file path to the picture on the hard drive
Value of type 'String' cannot be converted to 'System.Drawing.Image'.
I even tried making a dataObject thinking I could use my temp string as the path to the picture for the pictureObject, but guess what, it didn't work.
Dim pictureObject As DataObject
pictureObject = New DataObject