title: Winforms Progress Bar update
body: <p>I'm a new programmer to C# and I would like some help. I searched a lot but I didn't find a simple example. Please see the code below:</p>
  
  <pre><code> public partial class Welcome : Form
   {
       public Welcome()
       {
           InitializeComponent();
       }
  
       private void button3_Click(object sender, EventArgs e)
       {
           Compare comp = new Compare();
           comp.Comparator();
       }
   }
  </code></pre>
  
  <p>In the <code>Compare</code> <code>Class</code> I have a simple method that contains a simple loop:</p>
  
  <pre><code> public class Compare
   {
       public void Comparator()
       {
           for (int i;i&lt;val;i++)
           { /* ............. */ }
       }
  
   }
  </code></pre>
  
  <p>I want to update the <code>ProgressBar</code> in parallel with an increment of the value of <code>i</code>.</p>