title: Showing progress value from a list of tasks through ProgressBar
body: <p>My title may make my question sound confusing, but it is not.</p>
  
  <p>I have a list of tasks to do and a <code>ProgressBar</code>. When I loop through the list of tasks, I want to display the progress through a <code>ProgressBar</code>:</p>
  
  <pre><code>        double percentage;
          for(int i = 0; i &lt; tasks.Count; i++)
          {
              percentage = (double)i + 1 / (double)tasks.Count;
              this.Invoke((MethodInvoker)delegate
              {
                  progressBar1.Value = (int)Math.Round(percentage * 100);
              });
              // Do tasks here...
          }
  </code></pre>
  
  <p>So if I have say, 20 tasks I want <code>progressBar1</code> to have the value of 5 <code>((1 / 20) * 100)</code>, then when it loops through again it has the value of 10, 15 and so on. The method that I am using right now does not work properly, on the first task <code>progressBar1</code> has a value of 0, then when it loops through again it has the value of 100. Is there a way of doing what I am trying to achieve?</p>
  
  <p>Thanks.</p>