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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:41:54+00:00 2026-05-18T22:41:54+00:00

I have tried to navigate through a couple of web pages using an backgroundworker

  • 0

I have tried to navigate through a couple of web pages using an backgroundworker & webbrowser. Im using this function which it doesnt work. Im not sure what is going wrong here.

I see only the MessageBox.Show(arr[0]); nothing else. the webbrowser doesnt change too

private void bw_DoWork(object sender, DoWorkEventArgs e)
{
    string[] arr = { "http://stackoverflow.com/", "http://www.codeproject.com/", "http://www.codeplex.com/" };
    for (int i = 0; i < 3; i++)
    {
        MessageBox.Show(arr[i]);
        bB_checker.Invoke((EventHandler)delegate { bB_checker.Navigate(arr[i]); });
        while (bB_checker.ReadyState != WebBrowserReadyState.Complete)
        {
            //  System.Threading.Thread.Sleep(100);
            Application.DoEvents();
        }
    }
}
  • 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-18T22:41:55+00:00Added an answer on May 18, 2026 at 10:41 pm

    Never implement BGW without checking the e.Error property in the RunWorkerCompleted event handler:

        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
            if (e.Error != null) MessageBox.Show(e.Error.ToString());
        }
    

    The somewhat mysterious invalid cast exception is caused by using the ReadyState property on a worker thread. WebBrowser is not threadsafe. Check this answer for a way to create a WB on a worker thread.

    That’s not however a good way if you need to keep the browser visible to the user. You’ll have to give up on using threading in that case. Not a real problem, just count up the array index in the DocumentCompleted event handler. Albeit that it makes little sense to flash these web pages.

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

Sidebar

Related Questions

I have a form(HTML) in which I want to navigate through the elements using
I have a WebBrowser Control and have called the Navigate(url) function of it for
Have tried to find solutions for this and can't really come up with anything.
I have tried this but it does not work (even if I specify .wav
I have tried several ways to login to a website through java. I have
I have three pages, and to navigate to each page, I'm binding a property
My basic issue is this, I have events firing on pages I've left based
I have next link that lets users navigate through a list of URL (stored
I'm about to start a new project which would allow users to navigate through
I am using this method in Andengine to scroll through a list of items,

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.