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. Invoking an html button in a WebBrowser control

Invoking an html button in a WebBrowser control

Scheduled Pinned Locked Moved C#
csharphtmlhelptutorial
2 Posts 1 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.
  • M Offline
    M Offline
    Martin23
    wrote on last edited by
    #1

    Hi, I am making an application in VSC# 2005 which has a "WebBrowser" control in it, I want to be able to manipulate a webpage in the webrowser control from within the application. I have worked out how to get (and set) the text in a form on the webpage with something like; webBrowser1.Document.GetElementById("Textbox1").InnerText.ToString(); which is fine, but I just can't work out how to invoke a button on the webpage. Basically I want to get the text from the form, change it, paste it back into the form (all of which I can do) and then call the "Save" button to save my changes (which I can't do). Any help would be greatly appreciated! Thanks in advance, Martin.

    M 1 Reply Last reply
    0
    • M Martin23

      Hi, I am making an application in VSC# 2005 which has a "WebBrowser" control in it, I want to be able to manipulate a webpage in the webrowser control from within the application. I have worked out how to get (and set) the text in a form on the webpage with something like; webBrowser1.Document.GetElementById("Textbox1").InnerText.ToString(); which is fine, but I just can't work out how to invoke a button on the webpage. Basically I want to get the text from the form, change it, paste it back into the form (all of which I can do) and then call the "Save" button to save my changes (which I can't do). Any help would be greatly appreciated! Thanks in advance, Martin.

      M Offline
      M Offline
      Martin23
      wrote on last edited by
      #2

      OK I worked out one way, by putting the user focus on the correct button, then simulating pressing the enter key; webBrowser1.Document.GetElementById("Save").Focus(); SendKeys.Send("{ENTER}"); but it's pretty ugly, and possibly not very robust. Anyone got any better ideas? thanks

      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