Accessing html element or client side javascript object from C#.

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hi,
I am developing desktop application. In the desktop application am loading a
html page, i want to acces html element value from C# code.
Can anyone help me? how to access a html element or clientside javascript
object from C# code.

Note: i am not using web server.

TIA,

Gary
 
Gary,

If you are hosting the web browser control that is showing the HTML,
then the control exposes a document property that you can use to get the
IHTMLDocument2 interface that represents the DOM of the HTML document. Once
you have this, you can access the document in any way that you wish.

You might want to add a reference to MSHTML.TLB in order to get the
types that you can access in the DOM.

Hope this helps.
 
Thanks a lot, Nicholas.
- Gary

Nicholas Paldino said:
Gary,

If you are hosting the web browser control that is showing the HTML,
then the control exposes a document property that you can use to get the
IHTMLDocument2 interface that represents the DOM of the HTML document. Once
you have this, you can access the document in any way that you wish.

You might want to add a reference to MSHTML.TLB in order to get the
types that you can access in the DOM.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Gary said:
Hi,
I am developing desktop application. In the desktop application am
loading
a
html page, i want to acces html element value from C# code.
Can anyone help me? how to access a html element or clientside javascript
object from C# code.

Note: i am not using web server.

TIA,

Gary
 
Back
Top