Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vb.net - webBrowser1 save image

Posted on 2013-06-06
1
Medium Priority
?
783 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 2000 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

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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 this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 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