public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
textBox1.Enabled = checkBox1.Checked;
}
private void Form1_Load(object sender, EventArgs e)
{
checkBox1.Checked = false;
}
I set the check state in load event handler, and why in this case, the CheckedChanged not fired?
If i click the check box, then the CheckedChanged is fired.
If your checked state is initially
false, then setting it tofalseagain doesn’t fire theCheckedChangedevent.That happens because the checked state isn’t actually changed
This is the internal code used when trying to set the
CheckBox1.Checkedproperty