mralston
Dec 6th, 2002, 05:50 AM
I want to load an image into a PictureBox from a URL at runtime. Any ideas how?
I was attempting to do it like this' Get image
Dim oXMLHTTP As New MSXML2.XMLHTTP()
oXMLHTTP.open("GET", "http://www.site.com/image.jpg")
oXMLHTTP.send()
Dim strImage As System.IO.Stream = oXMLHTTP.responseStream
oXMLHTTP = Nothing
' Load image into Picture Box
picProductImage.Image = Image.FromStream(strImage)but it told me that the cast (data type?) of the responsestream and image objects didn't match. I also tried usingpicProductImage.Image = Image.FromFile("http://www.site.com/image.jpg")Only to be told that the FromFile method didn't support URLs.
So I'm stuck.
I was attempting to do it like this' Get image
Dim oXMLHTTP As New MSXML2.XMLHTTP()
oXMLHTTP.open("GET", "http://www.site.com/image.jpg")
oXMLHTTP.send()
Dim strImage As System.IO.Stream = oXMLHTTP.responseStream
oXMLHTTP = Nothing
' Load image into Picture Box
picProductImage.Image = Image.FromStream(strImage)but it told me that the cast (data type?) of the responsestream and image objects didn't match. I also tried usingpicProductImage.Image = Image.FromFile("http://www.site.com/image.jpg")Only to be told that the FromFile method didn't support URLs.
So I'm stuck.