Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:28:05+00:00 2026-05-23T03:28:05+00:00

I have a form with an embedded web browser control on it. I am

  • 0

I have a form with an embedded web browser control on it. I am currently using WebBrowser and use it like so:

webBrowser1.Navigate("about:blank");
HtmlDocument doc = this.webBrowser1.Document;
doc.Write(string.Empty);
String htmlContent = GetHTML();
doc.Write(htmlContent);

This writes the HTML correctly to the web browser control BUT it never clears the existing data and it just appends, so I end up with N web pages stacked on top of each other.

Is this the best control to use? If so why is it not clearing existing data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:28:06+00:00Added an answer on May 23, 2026 at 3:28 am

    You need to use:

    HtmlDocument doc = this.webBrowser1.Document.OpenNew(true);
    

    now the contents of the document will be cleared before writing.

    All calls to Write should be preceded
    by a call to OpenNew, which will clear
    the current document and all of its
    variables. Your calls to Write will
    create a new HTML document in its
    place. To change only a specific
    portion of the document, obtain the
    appropriate HtmlElement and set its
    InnerHtml property.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a basic Windows Form app in C# that has an embedded
I have a c# windows form project using watin. I would love to attach
I have created a form in Google Apps Script and embedded it into Google
I have a page with a form. There is an input control I populate
So, I've read a lot about using ExtJS's fileuploadfield to submit a form via
I have a problem with .Net's RichTextBox control. It seems that it doesn't support
We have a series of products with built in web servers each of which
I am using a WebBrowser object to render text which is presented in a
I'm working on fixing up a legacy web application with jQuery. I have a
I have this existing environment: 1) ASP.NET 3.5 web application 2) forms authentication with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.