Solved

vb.net - webBrowser1 save image

Posted on 2013-06-06
1
719 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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