C# MessageBox shown twice
<p>I have several groupboxes on a windows form with a check box, number picker &amp; combo box.  If the check box is not selected I want the other elements disabled.  I've disabled everything but the checkboxes on load and then coded 'if/else' criteria on the CheckedChanged event and all works fine.  However a couple of group boxes are dependent on another condition from an earlier form.  So if a user tries to select that checkbox but the condition isn't valid, I want to display a message, uncheck the checkbox and disable the other elements in the groupbox until the user goes back and changes the condition ... or just accepts things as they are and moves on.  All works pretty much as expected, except the message box is displayed twice, i.e. displayed, cancel out, displayed again ... I'm thinking once when the box is checked and again when it's unchecked (if I just leave it checked, but disabled, the message is only shown once, but that's kind of ugly. ;-(  Is there a better way to do this?</p>

<pre><code>private void checkbox1_CheckedChanged(object sender, EventArgs e)
    {
        if(var1 == "YES")
        {
            if (checkbox1.Checked)
            {
                numbox.Enabled = true;
                combobox1.Enabled = true;
            }
            else
            {
                numbox.Enabled = false;
                combobox1.Enabled = false;
            }
        }
        else
        {
            MessageBox.Show("Required condition is not YES");
            checkbox1.Checked = false;
        }
    }
</code></pre>