Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2012/5.0 > C# 2012/5.0 General Discussion
| Search | Today's Posts | Mark Forums Read
C# 2012/5.0 General Discussion Discussions about the C# 2012 language and tool not related to any specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2012/5.0 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 27th, 2012, 10:13 PM
Friend of Wrox
Points: 660, Level: 9
Points: 660, Level: 9 Points: 660, Level: 9 Points: 660, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: St. Louis, , .
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Default How do I expose the LoadCompleted method in the WebBrowser class in WPF C#?

How do I expose the LoadCompleted method in the WebBrowser class in WPF C#?
I am trying to write a C# program in wpf that retrieves the content of a web page.

The first thing I tried was to try the WebRequest and WebResponse classes. This did not provide the actual displayed content. WebResponse reveils the HTML code that is sent to the browser. But I discovered that, while the page is being loaded by the browser, javascript can change what content is finally displayed in the browser.

So I decided to use the WebBrowser class.

Immediately I found that there are two WebBrowser classes. Thee is the one that is documented for WinForms and there is another that is documented for WPF. I need to understand the one documented for WPF. What I think I neeed to know what to do is to retrieve code after the "LoadCompleted" method is caused. But I do not know how to this and I cannot find any example demonstrating how this is done.
  #2 (permalink)  
Old November 5th, 2012, 05:43 PM
Wrox Author
Points: 1,163, Level: 13
Points: 1,163, Level: 13 Points: 1,163, Level: 13 Points: 1,163, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2010
Location: Austria
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts
Default

The WebBrowser class is just a wrapper for the COM object of the IE. You can access the browser object model with the Document property of the WebBrowser, e.g.
Code:
HTMLDocumentClass doc = (HTMLDocumentClass)webBrowser.Document;
The HTMLDocumentClass is defined with the COM object definitions in the MSHTML library (add a reference to the Microsoft HTML Object Library).

Hope this helps.
__________________
Christian
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a parent class method from a child class (Zend Cert) crmpicco Beginning PHP 2 July 30th, 2010 04:22 AM
How do you access the children of a WPF Canvas class? Bill_Thompson C# 2005 0 June 30th, 2010 08:42 AM
How to expose limited no of Web method in a WebService khatu_jec ASP.NET 2.0 Professional 1 December 26th, 2008 08:33 PM
Using the PreProcessMessage method in WebBrowser maxl VB How-To 1 January 16th, 2007 05:15 PM
Expose BLL for Web Service stan92 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 November 30th, 2006 04:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.