LiveWire Peer Support Network

Printable Version of Topic "VB6 - URL as Image box location"

- LiveWire Teen Forums & College Forums (http://www.golivewire.com)
-- (http://www.golivewire.com/forums/support-technical.html)
--- Programming & Application Development (http://www.golivewire.com/forums/forum-211-s-0.html)
---- VB6 - URL as Image box location (http://www.golivewire.com/forums/peer-oanebo-support-a.html)


-- Posted by masterfultemptation at 5:08 pm on June 1, 2006

Okay so I a URL of an image...but when I set the image box's location to the URL, it says type mismatch.
This is the code now:

ArtistImage.Picture = "http://home.cogeco.ca/~nickj/new.gif"

Is there a way to get the image from that URL into the image box without using a Winsock control to download it?


-- Posted by telomere13 at 6:31 pm on June 1, 2006

I don't know of a way offhand using an image box, but perhaps you can cheat by using a webbrowser control and directing it to that URL.


-- Posted by masterfultemptation at 6:48 am on June 2, 2006

yeah, i was thinking about that...but i dont want the scroll boxes and am too lazy to find a way to get rid of them.  actually, i tried this and it seems to work:

Code:

Dim Array1() As Byte, FileNumber As Long, TempFile As String
TempFile = App.Path & "temp.jpg"
Array1() = Inet1.OpenURL(ImageURL, icByteArray)
FileNumber = FreeFile
Open PicFile For Binary Access Write As #FileNumber
Put #FileNumber, , Array1()
Close #FileNumber
imgArtist.Picture = LoadPicture(PicFile)
Kill PicFile


www.golivewire.com