title: Why does Thread.Sleep() freeze the Form?
body: <p>I try to experiment with <code>Thread.Sleep()</code>. I created basic Windows Forms application with one button.</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          Thread thread1 = new Thread(DoStuff);
          thread1.Start();
  
          for (int i = 0; i &lt; 100000; i++)
          {
              Thread.Sleep(500);
              button1.Text +=".";
          }
      }
  
      public void DoStuff()
      {
         //DoStuff         
      }
  </code></pre>
  
  <p>When I click my button the <code>DoStuff</code> method works fine, but the GUI freezes and nothing happens. Can someone explain me why?</p>