title: Change TextBox BackColor in run time
body: <p>I've 4 textboxes and 1 button.
  When the button is pressed, it pings the 4 ip addresses, then changes the textboxes color according to ping status.</p>
  
  <p>What I want to do is, when button is pressed all textboxes backcolor changes to white before the pings start.</p>
  
  <p>I wrote the following code, but it didn't work.</p>
  
  <p>My Codes:</p>
  
  <pre><code>public void Clear1()
          {
              txtHKB1.BackColor = Color.Yellow;
              txtHKB2.BackColor = Color.Yellow;
              txtHKB3.BackColor = Color.Yellow;
              txtHKB4.BackColor = Color.Yellow;
          }
  
          public void Clear2()
          {
              txtHKB1.Text = "";
              txtHKB2.Text = "";
              txtHKB3.Text = "";
              txtHKB4.Text = "";
          }
  
      private void btnConnect_Click(object sender, EventArgs e)
              {
                  //b.Baglan("192.168.20.50","9050");
              }
  
              private void btnSistemIzle_Click(object sender, EventArgs e)
              {
                  Thread th1 = new Thread(new ThreadStart(Clear1));
                  Thread th2 = new Thread(new ThreadStart(Clear2));
  
                  th1.Start();
                  th2.Start();
  
                  SistemIzle("192.168.20.60");            
                  SistemIzle("192.168.20.80");
                  SistemIzle("192.168.20.100");
                  SistemIzle("192.168.20.120");
  
                  counter2++;
              }
  
              public void SystemAnalyse(string ip)
              {
                  try
                  {
                      IPAddress ipAddress = Dns.GetHostEntry(ip).AddressList[0];
  
                      //for (int i = 0; i &lt; 3; i++)
                      //{
                      System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
                      System.Net.NetworkInformation.PingReply pingReply = ping.Send(ipAddress);
  
                      counter++;
  
                      //MessageBox.Show(pingReply.Buffer.Count().ToString() + pingReply.RoundtripTime.ToString()
                      //        + pingReply.Options.Ttl.ToString() + pingReply.Status.ToString());
  
                          //System.Threading.Thread.Sleep(100);
                      //}
  
                  }
  
                  catch
                  {
                      //MessageBox.Show("Başarısız Girişim!");
                      fail++;
                  }
  
                  if (counter % 4 == 1 &amp;&amp; fail == 0)
                  {
                      txtHKB1.BackColor = Color.Green;
                      txtHKB1.Text = "                         Yayinda";
                  }
  
                  if (counter % 4 == 1 &amp;&amp; fail == 1)
                  {
                      fail = 0;
                      txtHKB1.BackColor = Color.Red;
                      txtHKB1.Text = "                         Kapalı";
                  }
  
                  if (counter % 4 == 2 &amp;&amp; fail == 0)
                  {
                      txtHKB2.BackColor = Color.Green;
                      txtHKB2.Text = "                         Yayinda";
                  }
  
                  if (counter % 4 == 2 &amp;&amp; fail == 1)
                  {
                      fail = 0;
                      txtHKB2.BackColor = Color.Red;
                      txtHKB2.Text = "                         Kapalı";
                  }
  
                  if (counter % 4 == 3 &amp;&amp; fail == 0)
                  {
                      txtHKB3.BackColor = Color.Green;
                      txtHKB3.Text = "                         Yayinda";
                  }
  
                  if (counter % 4 == 3 &amp;&amp; fail == 1)
                  {
                      fail = 0;
                      txtHKB3.BackColor = Color.Red;
                      txtHKB3.Text = "                         Kapalı";
                  }
  
                  if (counter % 4 == 0 &amp;&amp; fail == 0)
                  {
                      txtHKB4.BackColor = Color.Green;
                      txtHKB4.Text = "                         Yayinda";
                  }
  
                  if (counter % 4 == 0 &amp;&amp; fail == 1)
                  {
                      fail = 0;
                      txtHKB4.BackColor = Color.Red;
                      txtHKB4.Text = "                         Kapalı";
                  }
              }
  </code></pre>
  
  <p>What I'm doing wrong?
  My best regards...</p>