Backgroundworker progresschanged not updating

posted by | Leave a comment

Instead, you have to invoke a method on the UI (main) thread which then makes the desired changes.

This is all a bit cumbersome, but not when you use the Background Worker.

backgroundworker progresschanged not updating-45backgroundworker progresschanged not updating-44

In this first example, we want a pretty simply but time consuming job performed.When performing a task on a different thread, you usually have to communicate with the rest of the application in two situations: When you want to update it to show how far you are in the process, and then of course when the task is done and you want to show the result.The Background Worker is built around this idea, and therefore comes with the two events Progress Changed and Run Worker Completed.Each number between 0 and 10.000 gets tested to see if it's divisible with the number 7.This is actually a piece of cake for today's fast computers, so to make it more time consuming and thereby easier to prove our point, I've added a one millisecond delay in each of the iterations.

Leave a Reply

Free online hot sex chat sighs