Solved

vb.net - webBrowser1 save image

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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:…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

14 Experts available now in Live!

Get 1:1 Help Now