I’m working on a Windows form which should enable / disable some controls based on a checkbox’s checked status. To watch for this, there is an event handler for the CheckedChanged event. This has worked for other forms just fine, with the same exact code, but it is not working correctly here. Whether the checkbox is being checked or unchecked, the checked state is always false. Here’s the code:
private void chkDisable_CheckedChanged(object sender, EventArgs e)
{
if (chkDisable.Checked)
{
DisableFormFields();
}
else
{
EnableFormFields();
}
}
Like I said, this exact code works fine in one form — the Checked state is correctly set to true or false based on what you just changed it to. But in the new form, the Checked state is always false in that method, whether it is being checked or unchecked. The event fires fine, and hits the breakpoint I set in the method, but the Checked state never changes. Any advice?
Thanks!
Try this