Solved

vb.net - webBrowser1 save image

Posted on 2013-06-06
1
731 Views
Last Modified: 2013-06-07
hello there,
for example If I visit google... how can I save the logo without downloading it again.
when I right click and save image it works like a charm but when I try to save it doesnt work.
0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
jay813 earned 500 total points
ID: 39230836
You might want to clarify what you mean by "save the logo without downloading it again".  If you are trying to programatically save the image, then I think you either need to know the direct source of the image or create a collection of images and iterate through it until you find a match.

After navigating the web browser, and the web-page is readystate.complete, you could do:

       
 Dim WebImgs = WebBrowser1.Document.GetElementsByTagName("Img") 'create collection


        For Each image In WebImgs

            With image.domelement 'use dom element for the finer details

                If .alt = "Google" And .width = 275 And .height = 95 Then 

                    Dim Client As New WebClient 'if an image on the page meets criteria
                    Client.DownloadFile(.href, "C:\Users\Win7User\Desktop\" & .nameprop) 
                    Client.Dispose()
                End If


            End With

        Next

Open in new window


So in this example, should an image on that page match the speficiations for the ALT string and image Size, a webClient will be invoked which would save the item to your desktop as the filename it encounters (google.png for example).
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question