private void set_Control_Enable(Boolean enabled)
{
//For each control
foreach (Control control in allUserControls)
{
//If the control isn't bound
if (control.DataBindings.Count < 1)
{
if (control is TextBox)
{
//Blank out text boxes
control.Text = "";
}
else if (control is ListBox && ((ListBox)control).DataSource == null)
{
//Clear listboxes
((ListBox)control).Items.Clear();
}
else if (control is CheckBox)
{
//Uncheck check boxes
((CheckBox)control).Checked = false;
}
}
//Set enabled
control.Enabled = enabled;
}
}