public bool Eval(Control control) { bool ok = true; string name = control.GetType().Name; switch (name) { case "TextBox": handler = new TextBoxHandler((TextBox)control); break; case "DateTimePicker": handler = new DateTimePickerHandler((DateTimePicker)control); break; case "ComboBox": handler = new ComboBoxHandler((ComboBox)control); break; case "MaskedTextBox": handler = new MaskedTextBoxHandler((MaskedTextBox)control); break; default: { Utils.error($"control {control.Name} instance of {name} no has been configurated"); } break; } if (!(ok = handler.GetData())) { Utils.error($"from control {control.Name}"); OnError(control); // MessageBox.Show($"{control.Name}"); } return(ok); }