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. .NET (Core and Framework)
  4. XML inside WebBrowser control causes large delay when unloading the control

XML inside WebBrowser control causes large delay when unloading the control

Scheduled Pinned Locked Moved .NET (Core and Framework)
xmlperformancehelpquestion
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
    Michael Wolski
    wrote on last edited by
    #1

    Has anyone experienced this, or a workaround? I am using a WebBrowser control to display an xml file from the file system. The size of the xml file is 190k. Everything is fine except when I close the control (say using a tabbed interface). When closing/removing the browser control, the application experiences a large delay (~7 secs on my machine). Internet Explorer (7) does not show this behavior; it loads up the file at the same speed (as me) and closes immediately with no delay. Any insight would be appreciated. Here is the code I refined down to illustrate the problem. private void Form1_Load(object sender, EventArgs e) { TabPage page = this.tabControl1.TabPages[0]; WebBrowser wb = (WebBrowser)page.Controls[0]; // this file is ~190k, takes 3 secs to load. wb.Navigate(@"D:\temp\large.xml"); } private void button1_Click(object sender, EventArgs e) { // From here... this.tabControl1.TabPages.Remove(this.tabControl1.SelectedTab); // ... to here takes about 7 seconds. }

    Michael Developer, Author, Chef

    M 1 Reply Last reply
    0
    • M Michael Wolski

      Has anyone experienced this, or a workaround? I am using a WebBrowser control to display an xml file from the file system. The size of the xml file is 190k. Everything is fine except when I close the control (say using a tabbed interface). When closing/removing the browser control, the application experiences a large delay (~7 secs on my machine). Internet Explorer (7) does not show this behavior; it loads up the file at the same speed (as me) and closes immediately with no delay. Any insight would be appreciated. Here is the code I refined down to illustrate the problem. private void Form1_Load(object sender, EventArgs e) { TabPage page = this.tabControl1.TabPages[0]; WebBrowser wb = (WebBrowser)page.Controls[0]; // this file is ~190k, takes 3 secs to load. wb.Navigate(@"D:\temp\large.xml"); } private void button1_Click(object sender, EventArgs e) { // From here... this.tabControl1.TabPages.Remove(this.tabControl1.SelectedTab); // ... to here takes about 7 seconds. }

      Michael Developer, Author, Chef

      M Offline
      M Offline
      Michael Wolski
      wrote on last edited by
      #2

      Well, it seems whenever i ask a question I figure out a workaround. In this case, I am still not 100% sure why this works. And yes, the DoEvents() is necessary for this the page to close quickly (due to asnync loading I guess). private void button1_Click(object sender, EventArgs e) { // From here... WebBrowser wb = (WebBrowser)this.tabControl1.SelectedTab.Controls[0]; wb.Navigate(""); Application.DoEvents(); this.tabControl1.TabPages.Remove(this.tabControl1.SelectedTab); // ... to here now takes about 1 second. }

      Michael Developer, Author, Chef

      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