title: Checkbox array in C#
body: <p>Im trying to create a array of Checkboxes in Winforms and I  have four Checkboxes and if I click on a Checkbox, a messagebox should display the checkboxes checked. </p>
  
  <pre><code> public void checkboxtest()
      {
  
          CheckBox[] boxes = new CheckBox[4];
          boxes[0] = checkBox1;
          boxes[1] = checkBox2;
          boxes[2] = checkBox3;
          boxes[3] = checkBox4;
  
  
          for (int i = 0; i &lt;= 4; i++)
          {
  
                  if (boxes[i].Checked == true &amp;&amp; boxes[i].Enabled)
                  {
                      MessageBox.Show("boxes[i] is clicked");
                  }
  
          }
      }
  
      private void checkBox1_CheckedChanged(object sender, EventArgs e)
      {
          checkboxtest();
      }
  
      private void checkBox2_CheckedChanged(object sender, EventArgs e)
      {
          checkboxtest();
      }
  </code></pre>
  
  <p>continues for 3 and 4 too... </p>
  
  <p>How should I go about it ?? 
  Thanks. </p>