|
-
Mar 20th, 2006, 11:32 AM
#1
Thread Starter
Member
How to display the internet image in picturebox using HttpWebRequest
Hi,
I am beginner, and try it a long time and can not find the solution...
Just want show the picture which in the internet...I will try using HttpWebRequest, because it will using in the mobile..
Thx
-
Mar 20th, 2006, 04:32 PM
#2
Re: How to display the internet image in picturebox using HttpWebRequest
you need to use the HttpWebResponse & then it's GetResponseStream
then you can create an image using Image.FromStream.
like this ....
VB Code:
[COLOR=Blue]Dim[/COLOR] request [COLOR=Blue]As[/COLOR] HttpWebRequest = [COLOR=Blue]DirectCast[/COLOR](HttpWebRequest.Create("http://www.google.co.uk/intl/en_uk/images/logo.gif"), HttpWebRequest)
[COLOR=Blue]Dim[/COLOR] response [COLOR=Blue]As[/COLOR] HttpWebResponse = request.GetResponse
[COLOR=Blue]Dim[/COLOR] img [COLOR=Blue]As[/COLOR] Image = Image.FromStream(response.GetResponseStream)
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
PictureBox1.Image = img
response.Close()
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Mar 21st, 2006, 05:40 AM
#3
Thread Starter
Member
Re: How to display the internet image in picturebox using HttpWebRequest
Last edited by simoms; Apr 10th, 2006 at 01:20 AM.
-
Apr 10th, 2006, 01:21 AM
#4
Thread Starter
Member
Re: How to display the internet image in picturebox using HttpWebRequest
more one question:
How can I save the picture into the directory, using this method!!
-
Apr 10th, 2006, 01:52 AM
#5
Re: How to display the internet image in picturebox using HttpWebRequest
Theres also a codebank submission by kleinma that shows how to do it using the System.Net.Webclient...
http://www.vbforums.com/showthread.php?t=387841
-
Apr 10th, 2006, 08:27 AM
#6
Thread Starter
Member
Re: How to display the internet image in picturebox using HttpWebRequest
Thanks for your reply...
I need to use httpRequest to do it, because I need use in the pocket pc
-
Apr 10th, 2006, 01:55 PM
#7
New Member
Re: How to display the internet image in picturebox using HttpWebRequest
I'm using VB 2005 Basic Express.
I tried to enter this code, but I get the following error:
"Type 'HttpWebrequest' is not defined"
Do I need a different version to be able to use "HttpWebRequest"?
Thanks!
-
Apr 10th, 2006, 02:56 PM
#8
Re: How to display the internet image in picturebox using HttpWebRequest
 Originally Posted by Vmax1001
I'm using VB 2005 Basic Express.
I tried to enter this code, but I get the following error:
"Type 'HttpWebrequest' is not defined"
Do I need a different version to be able to use "HttpWebRequest"?
Thanks!
No, you probably just didn't fully qualify it with its namespace
Dim MyRequest as System.Net.HttpWebRequest
-
Apr 10th, 2006, 02:58 PM
#9
Re: How to display the internet image in picturebox using HttpWebRequest
 Originally Posted by simoms
more one question:
How can I save the picture into the directory, using this method!!
You can save a picture to file using the picturebox itself...
Lets say your picturebox is called Picturebox1...
VB Code:
picturebox1.Image.Save([i]File Name Here[/i])
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|