Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WebBrowser and Console Applications

WebBrowser and Console Applications

Scheduled Pinned Locked Moved C#
htmlcsharpcomdata-structurestools
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    S Senthil Kumar
    wrote on last edited by
    #1

    Does the WebBrowser control introduced in .NET 2.0 work fine with console applications? I'm facing problems doing something like

    string x = "abc";
    browser.DocumentText = x;

    Unfortunately, x never gets set, browser.DocumentText always remains as <HTML> </HTML> On a hunch, I tried doing an Application.DoEvents right after setting the DocumentText property and it worked. Does that mean there is no *easy* way to use the WebBrowser just for inspecting and manipulating the DOM tree? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

    J D 2 Replies Last reply
    0
    • S S Senthil Kumar

      Does the WebBrowser control introduced in .NET 2.0 work fine with console applications? I'm facing problems doing something like

      string x = "abc";
      browser.DocumentText = x;

      Unfortunately, x never gets set, browser.DocumentText always remains as <HTML> </HTML> On a hunch, I tried doing an Application.DoEvents right after setting the DocumentText property and it worked. Does that mean there is no *easy* way to use the WebBrowser just for inspecting and manipulating the DOM tree? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      We've had trouble with WebBrowser controls without a parent; you may end up having to create an invisible form and add the browser to that form before you can do things with the document.

      S 1 Reply Last reply
      0
      • S S Senthil Kumar

        Does the WebBrowser control introduced in .NET 2.0 work fine with console applications? I'm facing problems doing something like

        string x = "abc";
        browser.DocumentText = x;

        Unfortunately, x never gets set, browser.DocumentText always remains as <HTML> </HTML> On a hunch, I tried doing an Application.DoEvents right after setting the DocumentText property and it worked. Does that mean there is no *easy* way to use the WebBrowser just for inspecting and manipulating the DOM tree? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Yeah, the WebBrowser control won't work properly without a parent form, which you don't have in a Console app. You'll have to create a form to put the control on, but just never show the form. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        S 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Yeah, the WebBrowser control won't work properly without a parent form, which you don't have in a Console app. You'll have to create a form to put the control on, but just never show the form. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          Your suggestion worked, thank you :) Regards Senthil _____________________________ My Blog | My Articles | WinMacro

          1 Reply Last reply
          0
          • J Judah Gabriel Himango

            We've had trouble with WebBrowser controls without a parent; you may end up having to create an invisible form and add the browser to that form before you can do things with the document.

            S Offline
            S Offline
            S Senthil Kumar
            wrote on last edited by
            #5

            That did the trick, thank you. I dearly wish .NET 2.0 provided a class to do nothing else but parse HTML. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

            J 1 Reply Last reply
            0
            • S S Senthil Kumar

              That did the trick, thank you. I dearly wish .NET 2.0 provided a class to do nothing else but parse HTML. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

              J Offline
              J Offline
              Judah Gabriel Himango
              wrote on last edited by
              #6

              S. Senthil Kumar wrote:

              I dearly wish .NET 2.0 provided a class to do nothing else but parse HTML.

              I agree.

              Tech, life, family, faith: Give me a visit. I'm currently blogging about: Bought a House! Judah Himango

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups