title: Multiple buttons different properties loop
body: <p>I'm setting up a windowsform that pings all my IP's at work and changes the <code>button.BackColor</code> accordingly.</p>
  
  <pre><code>Ping pingClassxx = new Ping();
  PingReply pingxx = pingClassxx.Send("192.168.xx.xx");
  
  if (pingxx.Status == IPStatus.Success)
  {
      button1.BackColor = Color.Green;
      button1.Text = "SQL Server | Online";
  }
  else
  {
      button1.BackColor = Color.Red;
      button1.Text = "SQL Server | Offline";
  }
  </code></pre>
  
  <p>Now I'm trying to do this to multiple machines so I went like this:</p>
  
  <pre><code>private void timer0_Tick(object sender, EventArgs e)
  {
      timer1.Stop();
  
      int iCount0 = 0;
      string[] arr = new string[8];
      arr[0] = "192.168.x.xx";        //button0
      arr[1] = "192.168.x.yy";        //button1
      arr[2] = "192.168.x.zz";        //button2
      arr[3] = "192.168.x.xy";        //button3
      arr[4] = "192.168.x.xz";        //button4
      arr[5] = "192.168.x.yx";        //button5
      arr[6] = "192.168.yy.yz";       //button6
      arr[7] = "192.168.x.ww";        //button7
  
      for (int I = 0; I &lt; arr.Length ; I++)
      {
          // Ping
          string s = arr[I];
          Console.WriteLine(s);
  
          Ping pingClassx = new Ping();
          PingReply pingx = pingClassx.Send(arr[I]);
  
          if (pingx.Status == IPStatus.Success)
          {
              [What do I do here?].BackColor = Color.Green;
          }
          else
          {
              [What do I do here?]BackColor = Color.Red;
          }
  
          // Loading Bar
          iCount2 += 1;
          progressBar0.Value = iCount2 * 100 / 8;
          label0.Text = iCount2 + "/8";
      }
  
      timer1.Start();
  }
  </code></pre>
  
  <p>How can I loop this?</p>
  
  <p>I could just repeat the code but I am sure there is a fancier way to do it.</p>