rye004
asked on
How do I download all images from a web page in C# using WPF?
I am trying to write a program using C# and WPF to download all images from a web page.
In my XAML I added the following control:
For testing, I created a test button that does the following:
How do I get a reference in my code above? Once I have the reference, how do I download it?
Any direction would be greatly appreciated.
Many Thanks!
In my XAML I added the following control:
<WebBrowser x:Name="scrapeWebBrowser" Grid.Column="1" Grid.Row="1"/>
For testing, I created a test button that does the following:
scrapeWebBrowser.Navigate("http://yahoo.com");
HTMLDocument objHtmlDocument = (HTMLDocument)scrapeWebBrowser.Document;
foreach (IHTMLElementCollection imageElements in objHtmlDocument.images)
{
//I am not sure what to do here. I am trying to get the reference to the image.
}
How do I get a reference in my code above? Once I have the reference, how do I download it?
Any direction would be greatly appreciated.
Many Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I did have to set the property for “Embedded Interop Types” to “False” under the reference for Microsoft.mshtml.
yes, you're correct on that!
ASKER