I’m building a form for searching a database inside my application, and I only want to add a control’s input as a WHERE if its enabled. The best method I have found is a set of checkboxes next to each set of controls to enable them.

Now, I can add the logic to the CheckedChanged of each checkbox, but I have several different types of controls- textboxes, datepickers, comboboxes. So they would have to be done individually- leading to quite a bit of boilerplate code.
private void ChartCheckBox_CheckedChanged(object sender, EventArgs e)
{
ClassComboBox.Enabled = ChartCheckBox.Checked;
}
Is there a faster way to do this?
I’d do this using a composite control – it’s exactly what you need.