tags:

views:

68

answers:

3

how do i go to a specified URL, grab a png image, and drop it onto my windows form in my vb.net windows application?

+1  A: 

You could simply put a WebBrowser control on your windows form and point it to the specified URL.

fretje
+1  A: 

I would put a picture control on the form then download the picture into a Picture object using HttpWebRequest. Then set the .picture attribute of the picture control box. I would write the code to do it but I'm a bit rusty with .net stuff.

Codygman
+2  A: 

Use a picture box as suggested before. But i would suggest you to use the WebClient-Class:

WebClient wc = new WebClient();
wc.DownloadFile("URL goes here", "Local file path goes here");

There is also a "DownloadFileAsync" method with events.

Update: The PictureBox class supports direct download via:

pictureBox.Load("http://yourdomain.net/Image.jpg");
Scordo
...and how would you display it on the form?
Kieren Johnstone
As stated above. Use the PictureBox. You can load a local image into the PictureBox by calling pictureBox1.Load(@"C:\Image.jpg") for example. BTW. You can also provide an url so the step of downloading the image first is not necessarily needed. Sample: pictureBox1.Load("http://www.cwcity.de/community/group/pics/view/165_grp_vw.jpg");
Scordo