vendredi 19 février 2016

Visual Studio C# - Reverse !Enabled foreach Checkbox if unchecked?

I have a bunch of checkboxes in a groupbox. I want to make it so when one is checked, all the others are disabled. I have the following code in a checkchanged event applied to all the checkboxes in the groupbox, which does what I wanted above but, I want to reverse this when you uncheck that box. How do I do so?

foreach (CheckBox chk in this.grpBreadType.Controls)
{
    if (!chk.Checked)
    {
        chk.Enabled = false;
    }




Aucun commentaire:

Enregistrer un commentaire