watersidedesigns
asked on
Load a web image in VB.net
Dear Sirs,
Is there anyway of retrieving an image from a URL and displaying it in a picturebox?
Is there anyway of retrieving an image from a URL and displaying it in a picturebox?
Three methods to do it apart from the above mentioned
1. http://weblogs.asp.net/psteele/articles/7533.aspx
2. http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=32290 . File stream can be URL as well
3. Use IE control instead of PictureBox. Though it would be heavy but it can easily have an Image from a URL
1. http://weblogs.asp.net/psteele/articles/7533.aspx
2. http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=32290 . File stream can be URL as well
3. Use IE control instead of PictureBox. Though it would be heavy but it can easily have an Image from a URL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ahh sorry armoghan... was a bit slow on the typing there... sorry to step on your toes
NP
It happens all the time :)
For that I used to wish that EE shoudl work like IM :)
It happens all the time :)
For that I used to wish that EE shoudl work like IM :)
I usually type out my response, copy it to the clipboard, refresh the page to check no one has posted, then paste it back in and submit... but Im just getting lazy nowadays
ASKER
Hi Guys,
Thanks for all the responses. As it happen I need to wait for the download to complete before I can continue so I have tried the webclient download mentioned by S-Twilley. However, whilst there is a pause as if something is happening, no image is downloaded.
Any Ideas?
Thanks for all the responses. As it happen I need to wait for the download to complete before I can continue so I have tried the webclient download mentioned by S-Twilley. However, whilst there is a pause as if something is happening, no image is downloaded.
Any Ideas?
ASKER
Ignore my last comment, my fault :)
Thanks for all your help
Thanks for all your help
well there's always going to be some sort of delay while the image is downloading... but maybe before you start the download, you load a local image into the picture box... maybe a "waiting for download" image... and once the download is complete, override the waiting image with the downloaded one
Dim wc As New Net.WebClient
Dim x As New Bitmap(wc.OpenRead("https://www.experts-exchange.com/images/expertAwards2004Button.gif"))
PictureBox1.Image = x
=========
goto vb.net... here's what I was getting at about loading the data straight into a bitmap.
Dim x As New Bitmap(wc.OpenRead("https://www.experts-exchange.com/images/expertAwards2004Button.gif"))
PictureBox1.Image = x
=========
goto vb.net... here's what I was getting at about loading the data straight into a bitmap.
You really should have split the points... or even awarded them all to the other two people... although I did put some sort of code in my comment, the others did post up valid links to solutions... I'm sure they're not going to come around and bust your front door down... but least remember it for next time :P
:)
ASKER
Sorry guys, will remember next time :)
Then pull the image from the web site to a temporary location.
then direct the picture box there.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetsocketssocketclasstopic.asp
Here is some info on using sockets.
You will want to use the connect method to get the web site.
cheers.