title: Update ProgressBar UI object from Task Parallel Library
body: <p>Basically i would like to update ProgressBar UI object on the FormMain (WindowsForm). I am using .NET 4.0</p>
  
  <p>Here are  the code in the Form1.Designer.cs</p>
  
  <pre><code>namespace ProgressBarApp
  {
      public partial class Form1 : Form
      {         
          private System.Windows.Forms.ProgressBar curProgressBar;
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              CustomProcess theProcess = new CustomProcess();
              theProcess.Process();
          }
      }
  }
  </code></pre>
  
  <p>Here is the definition of CustomProcess.cs</p>
  
  <pre><code>namespace ProgressBarApp
  {
      class CustomProcess
      {
          public void Process()
          {
              for (int i = 0; i &lt; 10; i++)
              {
                  Task ProcessATask = Task.Factory.StartNew(() =&gt;
                      {
                          Thread.Sleep(1000); // simulating a process
                      }
                   );
  
                  Task UpdateProgressBar = ProcessATask.ContinueWith((antecedent) =&gt;
                      { 
                          // how do i update the progress bar object at UI here ?
                      }
                   );
              }
          }
      }
  }
  </code></pre>