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

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
G

Gary

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top