Solved

vb.net - webBrowser1 save image

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to change the view engine in visual studio 2015 enterprises edition 7 41
SqlDataBase 7 46
Problem!!! 8 33
Batch file or script with password 22 38
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now