title: C# Infinite Rainbow Background Loop
body: <p>Why this infinite rainbow background loop is not working, I'm running this code in C# Forms and idea is to get background changing color after you clicked button1. I tried difference infinite loop makers like: for(;;). But here is the code: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>private void button1_Click(object sender, EventArgs e)
          {
      while (true)
      {
           this.BackColor = System.Drawing.Color.Red;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.DarkRed;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.Orange;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.Yellow;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.Green;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.DarkGreen;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.Blue;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.DarkBlue;
           System.Threading.Thread.Sleep(250);
           this.BackColor = System.Drawing.Color.Violet;
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>thank you.</p>