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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:35:54+00:00 2026-06-10T04:35:54+00:00

I have a problem with the Wunderground forecast that I am using to retrieve

  • 0

I have a problem with the Wunderground forecast that I am using to retrieve data in c# program.

When I click to retrieve data once everything is working correctly but when I hit the button once more I am getting this error:
Background Worker

Here is my code:

        private void bweather_DoWork(object sender, DoWorkEventArgs e)
        {
            string lat = Math.Round(deciLat).ToString();
            string lng = Math.Round(deciLon).ToString();
            string latlong = String.Format("{0},{1}", lat.Replace(',', '.'), lng.Replace(',', '.'));

            //Initialize Current as a new Day
            dow.Current = new WeatherLib.WDay();

            //Using Wunderground as the provider we populate the property with current data for the latlong entered into the textbox
            try
            {
                dow = WeatherLib.WProvider.Wunderground(latlong);
                writeToLogFile("Retrieve weather info successfully on: " + latlong);
            }
            catch (Exception ex)
            {
                writeToLogFile(ex.Message);
            }
        }

Here is the refresh button:

 private void weather_refresh_Click(object sender, EventArgs e)
        {
            writeToLogFile("Weather button pressed");
            weather_descripton.Clear();
            weather_speed_textbox.Clear();
            weather_tem_textbox.Clear();
            weather_rain_text.Clear();
            weather_wind_dir_textbox.Clear();
            weather_descripton.AppendText("Searching.......");
            if (!bweather.IsBusy)
            {
                bweather.CancelAsync();
            }
            bweather.RunWorkerAsync();
        }

And here are the event handlers:

// Weather handlers
            bweather.WorkerSupportsCancellation = true;
            bweather.DoWork += bweather_DoWork;
            bweather.RunWorkerCompleted += bweather_RunWorkerCompleted;

Any idea why is this not working as it should?

Thank you

  • 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-10T04:35:56+00:00Added an answer on June 10, 2026 at 4:35 am

    Well the error message suggests that you’re trying to use the same background worker more than once.

    You’re asking it to cancel if it’s still busy, but that doesn’t mean it’ll cancel immediately. As far as I can tell, the BackgroundWorker code isn’t even checking whether it’s been cancelled, which means cancelling it won’t really achieve anything useful.

    I would suggest that if it’s busy, you should instead just ignore the request. In fact, it might be better to disable the button completely when you start the operation, and only re-enable it when the operation completes.

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

Sidebar

Related Questions

I have problem while loading data into html select when users press or click
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with Uploadify: I log in the project using: FormsAuthentication.SetAuthCookie(myName, false); Then,
All, I am trying to download the weather data history from Wunderground. The problem
Have problem while getting data from Memcached on .NET MVC solution. I have this
i have problem to pass data from view to controller , i have view
I have problem with one of my validation regex when using nonstandard utf-8 character.
Have problem with linq expressions. I want to get from db some data ordered
I have problem with Activities navigation, searching works good. Activities hierarchy looks like that:

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.