C# checkbox
<p>I have 3 check boxes in each row of 8 total rows. I want to have the third checkbox in each row to get checked only when the first two checkboxes are unchecked. I do not want to write a checkRow() method for each row.</p>

<p>What is the best way to go about it?</p>

<pre><code>private void checkRow()
{
    for (int i = 0; i &lt; 8; i++)
    {
        var arraylist = new[] { checkbox1, checkbox2, checkbox3 };
        if (checkbox1.Checked || checkbox2.Checked)
        {
            arraylist[2].Checked = false;
        }
        else
            arraylist[2].Checked = true;
    }
}


private void checbox1_CheckedChanged(object sender, EventArgs e)
{
    checkRow();
}

private void checbox2_CheckedChanged(object sender, EventArgs e)
{
    checkRow();
}

private void checbox3_CheckedChanged(object sender, EventArgs e)
{
    checkRow();
}
</code></pre>

<p>In response.</p>

<pre><code>private void checkRow()
{
    var arraylist = new[] { checkEdit1, checkEdit2, checkEdit3 };
    var arraylist1 = new[] { checkEdit4, checkEdit5, checkEdit6 };
    var arraylist2 = new[] { checkEdit7, checkEdit8, checkEdit9 };
    var array = new[] { arraylist, arraylist1, arraylist2 };

    for (int i = 0; i &lt; 8; i++)
    {
        //if checkedit1 or checkedit2 is checked the checkedit3 should not be checked
        if (array[i]....Checked || array[i]....Checked)
        {
            arraylist[i]...Checked = false;
        }
        else
            arraylist[i]...Checked = true;
    }
}
</code></pre>

<p>I was trying to do something like this so that I dont have to write the checkRow() for each row</p>
