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. c# Webbrowser control with frames

c# Webbrowser control with frames

Scheduled Pinned Locked Moved C#
csharphelptutorial
3 Posts 2 Posters 1 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.
  • F Offline
    F Offline
    Franklin Smith
    wrote on last edited by
    #1

    I am trying to change the "onload" event of the Body in a frame. My problem is when I using the GetAttribute method on the Body it returns "System._ComObject" as a string rather than the attributes value. Please note it is not returning an object of System._ComObject, just the string. I tried just doing the change via Body.OuterHtml but that throws an expception of NotSupportedException. Which is odd seeing as it is a property that says it allows "get and set" operations. WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload") = "System.__ComObject" Any ideas on how to get this to behave as it should would be greatly appreciated. Even just a point in maybe the right direction. Also I did try this using "mshtml" objects and all it got me was the actual System._ComObject. However, I had no idea how to covert that to the string it was supposed to actually represent.

    H 1 Reply Last reply
    0
    • F Franklin Smith

      I am trying to change the "onload" event of the Body in a frame. My problem is when I using the GetAttribute method on the Body it returns "System._ComObject" as a string rather than the attributes value. Please note it is not returning an object of System._ComObject, just the string. I tried just doing the change via Body.OuterHtml but that throws an expception of NotSupportedException. Which is odd seeing as it is a property that says it allows "get and set" operations. WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload") = "System.__ComObject" Any ideas on how to get this to behave as it should would be greatly appreciated. Even just a point in maybe the right direction. Also I did try this using "mshtml" objects and all it got me was the actual System._ComObject. However, I had no idea how to covert that to the string it was supposed to actually represent.

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      From a (very) quick google it seems that that is the expected behaviour. Some of the hits I got suggest using

      WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").Name
      //+++++++++++++++++
      // OR
      //+++++++++++++++++
      WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").GetInterfaces()

      Although it seems that does not always work. In case you want to dig deeper I used c# system.__comobject as my search term. Nearly all the first page were about people having similar problems as yourself.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      F 1 Reply Last reply
      0
      • H Henry Minute

        From a (very) quick google it seems that that is the expected behaviour. Some of the hits I got suggest using

        WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").Name
        //+++++++++++++++++
        // OR
        //+++++++++++++++++
        WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").GetInterfaces()

        Although it seems that does not always work. In case you want to dig deeper I used c# system.__comobject as my search term. Nearly all the first page were about people having similar problems as yourself.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        F Offline
        F Offline
        Franklin Smith
        wrote on last edited by
        #3

        Thanks when I googled I must have been using the wrong search terms. I found a work around I just regexed the onload out of the body tag, then set the onload attribute the way I wanted it. Not the solution I wanted, but hey it works for what I needed. But doing it the right way will be more important when I start doing form fills on that page. I just wanted to keep this stupid popup alert that is in the body's onload event from activating.

        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