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 8741101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:14:53+00:00 2026-06-13T11:14:53+00:00

The only reason I chose to use a BackgroundWorker for the application I am

  • 0

The only reason I chose to use a BackgroundWorker for the application I am currently developing is to move the lengthy time-consuming browsing via a WebBrowser away from the UI thread.

But isn’t WebBrowser.Navigate() accessing the UI?

In other words, I went through all this effort, only to land in the same spot (or worse! because I have no idea what side-effects could a non-UI thread have when accessing UI controls).

I am pretty sure I am not the first one wanting to implement something like this, so my question is: What is an acceptable way to solve this problem? i.e. To WebBrowser.Navigate() from BackgroundWorker?

  • 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-13T11:14:54+00:00Added an answer on June 13, 2026 at 11:14 am

    Navigate() is not a blocking call (see the first line in the MSDN docs), but it does update UI, and so it needs to be called from the UI thread.

    You have a couple of options:

    1. Marshal the Navigate() call onto the UI thread from the BackgroundWorker via an Invoke call
    2. Don’t use a BackgroundWorker – just make the call to Navigate() from your UI (e.g. a button click event handler) and listen for the WebBrowser DocumentCompleted event.

    For an example of 1 – see https://stackoverflow.com/a/1862639/517244

    Here’s a code sample for 2:

    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }
    
        private void _goButton_Click(object sender, EventArgs e)
        {
            _webBrowser.Navigate("http://google.com/");
            // Non-blocking call - method will return immediately
            // and page will load in background
        }
    
        private void _webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            // Navigation complete, we can now process the document
            string html = _webBrowser.Document.Body.InnerHtml;
            // If the processing is time-consuming, then you could spin
            // off a BackgroundWorker here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the reason that ASP.NET MVC templates are available only for Web Application
What does IEquatable<T> buy you, exactly? The only reason I can see it being
I have some ActionScript3 code that for some reason only crashes in a stack
For some reason this only returns the name of the first item in the
For some reason my galleryScroll() function only runs once, even though the function calls
For some reason, siginterrupt() only seems to set the behaviour for the first signal
Have a simple form (only extract fields here) but for some reason the JQserilization
edit: Now for some reason each productid is only showing up once instead of
For some reason, the Server control menu disappeared. The only menu appears on the
For some reason, my scrollview, which only contains two TextViews for now, refuses to

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.