O'Reilly logo

C# 2008 and 2005 Threaded Programming: Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Using a BackgroundWorker to report progress in the UI

We are going to make some changes to our second example to take advantage of the features offered by the BackgroundWorker component to report progress in the user interface without delegates or callbacks. This way, we will be safe from the guards:

  1. Open the project, CodeBreakerApplication.
  2. Add four ProgressBar controls to frmMain (pgbProgressChar1, pgbProgressChar2, pgbProgressChar3, and pgbProgressChar4).
  3. Set the BackgroundWorker bakCodebreaker WorkerReportsProgress property to true.
  4. Add the following lines of code to the procedure setCodeBreakerVisibility. It will change the visibility of the new controls related to the progress of the code breaking procedure:
    // Change the visibility ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required