I have a CheckBox
that, when checked/unchecked will toggle the Enabled
property of some other controls. I did have my code looking something like this:
checkBox.CheckedChanged += new EventHandler((o, e) =>
{
control1.Enabled = checkBox.Checked;
control2.Enabled = checkBox.Checked;
});
But today I started playing with DataBindings
and discovered I could do this:
control1.DataBindings.Add("Enabled", checkBox, "Checked");
control1.DataBindings.Add("Enabled", checkBox, "Checked");
They seem to behave the same, but I suspect one is preferred over the other. Or perhaps one has some unexpected behavior that may trip me up later.
Is one way better than the other?