title: How to run two threads parallel?
body: <p>I start two threads with a button click and each thread invokes a separate routine and each routine will print thread name and value of <code>i</code>.</p>
  
  <p>Program runs perfectly, but I saw <code>Thread1()</code> function running first and then <code>Thread2()</code> routine starts, but I try to run <code>Thread1()</code> and <code>Thread2()</code> both in parallel. Where am I making a mistake?</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      Thread tid1 = new Thread(new ThreadStart(Thread1));
      Thread tid2 = new Thread(new ThreadStart(Thread2));
  
      tid1.Start();
      tid2.Start();
      MessageBox.Show("Done");
  }
  
  public static void Thread1()
  {
      for (int i = 1; i &lt;= 10; i++)
      {
      Console.Write(string.Format("Thread1 {0}", i)); 
      }
  }
  
  public static void Thread2()
  {
      for (int i = 1; i &lt;= 10; i++)
      {
      Console.Write(string.Format("Thread2 {0}", i)); 
      }
  }
  </code></pre>