I'm using the following code to clear all the textboxes on my form
private void ClearTextBoxes()
{
Action<Control.ControlCollection> func = null;
func = (controls) =>
{
foreach (Control control in controls)
if (control is TextBox)
(control as TextBox).Clear();
else
func(control.Controls);
};
func(Controls);
}
However, it also clears a DomainUpDown
, which in turn kicks out a warning because its text field is empty, how can I prevent this from happening?