title: Example without a for loop
body: <p>The most examples are with a for loop, and they work, and explain how a BackgroundWorker works. But how do I use a ProgressBar for a method that converts data? It takes a few minutes and I want to show the user the progress of the method.</p>
  
  <pre><code>private void DoWork(object sender, DoWorkEventArgs e)
  {
      for (int i = 0; i &lt;= 100; i++)
      {             
          Thread.Sleep(100);
          backgroundWorker.ReportProgress(i);
      }
  }
  </code></pre>
  
  <p>Here you give always I to update the value. But what if I want to do this?</p>
  
  <pre><code>private void DoWork(object sender, DoWorkEventArgs e)
  {
      ConvertDataMethod();
  
      backgroundWorker.ReportProgress(i); &lt;- What do I do here??
  }
  
  private void ProgressChanged(object sender, ProgressChangedEventArgs e)
  {
      progressBar.Value = e.ProgressPercentage;
  }
  </code></pre>