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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gary

    #1

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

    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


  • Nicholas Paldino [.NET/C# MVP]

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

    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]
    - nicholas.paldin o@exisconsultin g.com

    "Gary" <msnews@microso ft.com> wrote in message
    news:O8MLqRcUDH A.2568@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi,
    > I am developing desktop application. In the desktop application am loading[/color]
    a[color=blue]
    > 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
    >
    >[/color]


    Comment

    • Gary

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

      Thanks a lot, Nicholas.
      - Gary

      "Nicholas Paldino [.NET/C# MVP]" <nicholas.paldi no@exisconsulti ng.com> wrote
      in message news:OSdSJNeUDH A.2156@TK2MSFTN GP11.phx.gbl...[color=blue]
      > 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.[/color]
      Once[color=blue]
      > 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]
      > - nicholas.paldin o@exisconsultin g.com
      >
      > "Gary" <msnews@microso ft.com> wrote in message
      > news:O8MLqRcUDH A.2568@tk2msftn gp13.phx.gbl...[color=green]
      > > Hi,
      > > I am developing desktop application. In the desktop application am[/color][/color]
      loading[color=blue]
      > a[color=green]
      > > html page, i want to acces html element value from C# code.
      > > Can anyone help me? how to access a html element or clientside[/color][/color]
      javascript[color=blue][color=green]
      > > object from C# code.
      > >
      > > Note: i am not using web server.
      > >
      > > TIA,
      > >
      > > Gary
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...