|
-
Mar 14th, 2013, 12:24 PM
#1
Thread Starter
New Member
How can you get a dynamic image from a webbrowser?
I need to be able to get an image from webbrowser1 and display it in picturebox1. The problem is that the image is dyanamic, and will change every time it loads. Does anybody know how to directly copy the image over? I have been googling for about an hour now.
-
Mar 14th, 2013, 01:09 PM
#2
Re: How can you get a dynamic image from a webbrowser?
This is how you would get the image from the url in a picturebox:
Code:
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Google's logo
WebBrowser1.Navigate("http://www.google.com/intl/en/images/logo.gif")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
'The url of the image I'm assuming would be the url of webbrowser1.
Dim url_of_image As String = WebBrowser1.Url.ToString
'Set the picturebox's image to a bitmap of the image found in the website.
PictureBox1.Image = New System.Drawing.Bitmap(New IO.MemoryStream(New System.Net.WebClient().DownloadData(url_of_image)))
End Sub
End Class
The only thing that I could see a problem is getting the URL of the image.
-
Mar 14th, 2013, 01:53 PM
#3
Re: How can you get a dynamic image from a webbrowser?
Is the picture always in the same place on the page? If so it may be possible to use the surrounding HTML to locate the url. It would have been more than a little helpful to have supplied the source HTML anyway, if not the url of the page. Remember that we can't see what you have in front of you!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Mar 14th, 2013, 09:45 PM
#4
Re: How can you get a dynamic image from a webbrowser?
hmmm... a dynamic image from the web that changes everytime the page reloads... hmmm... what else do I know of that has that same kind of behavior? Ooooh... yeah.... Captcha images....
-tg
Tags for this Thread
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
|