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

  • SEARCH
  • Home
  • 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 8775495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:48:45+00:00 2026-06-13T18:48:45+00:00

The issue I am having is I have a WebBrowser control called Browser. The

  • 0

The issue I am having is I have a WebBrowser control called “Browser.” The browser is populated from a different controls created by MEF:

 //Apply Button that cretes the HTML that is loaded into the Browser
 btnCreateHTMLPreview(object sender, RoutedEventArgs e)
 {
   //Clears the content of the observable collection
   contents.Clear();

   //usedControls is an observable collection of all loaded controls in the stack panel
   foreach(var control in usedControls)
      control.CreateHTML();
 }

 //Code in the MEF Control that creates the HTML that is will be loaded into the browser
 CreateHTML()
 {
   string tempStuff = null;
   tempStuff += "<h1>" + MyControl.lblHeader.Content + "</h1>\n";
   tempStuff += MyControl.txtTextGoesHere.Text + "\n";

   //Give the HTML back to the Application
   parent.AcceptReport(tempStuff);
 }

 //Application side where it accepts the HTML and loads it into the Browser
 AcceptHTML(string passedInContent)
 {
   //Observable collection that holds the content of all possible MEF Controls
   contents.Add(passedInContent);

   string tempStuffForBrowser = null;
   tempStuffForBrowser = "<html>\n";
   tempStuffForBrowser += "<body>\n";

   //Add the content that was saved earlier
   foreach (var strInd in contents)
      tempStuffForBrowser += strInd;

   tempStuffForBrowser = "<html>\n";
   tempStuffForBrowser += "<body>\n";

   Browser.NavigateToString(tempStuffForBrowser);
 }

I did my best above to try and provide the meat of how I am populating the html and add that back into the browser. If there is anything that is unclear please just let me know.

If I have just one control added so that “content” only has the one control in it when I click the button to load the html, it works just fine and loads it in. However if I have more than one control loaded, I have to click that button twice to get it to show. I found this extremely bizarre. My attempt to solve this was to check and see if there was content in the Browser before leaving the event, but I am unsure how to do this. If anyone has any suggestions or any other ideas on how to solve this problem please let me know.

  • 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-06-13T18:48:46+00:00Added an answer on June 13, 2026 at 6:48 pm

    It looks like the WebBrowser control has some kind of issue where it doesn’t load the first string it gets; I’m assuming there’s some initialization that hasn’t happened yet. I got it to work by calling

    myBrowser.NavigateToString("");

    from within the constructor of my class, and then using it from then on worked correctly. Hokey but it works.

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

Sidebar

Related Questions

Hi guys I am having issue I have this query: SELECT * FROM useraccount
I'm having an issue with an if statement I have an object called enemy2
I have been having this issue in iterating through an array of keys and
I have been having an issue with the $this->delete() method that deletes a record
Just started mongo and started having issue with querying already. i have a collection
Having an issue here that I have tried everything I can think of but
I'm having an issue where I have a player object that I'm trying to
I'm having an issue with multiple markers on google maps - I currently have
I am having this issue. I have a script that checks if variable exists,
I am having an issue with somethign that I thoguth woudl have been simple.

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.