private void InputTextBox_Validating(object sender, CancelEventArgs e) { if (Validator != null) { var args = new InputBoxValidatingEventArgs {Text = InputTextBox.Text}; Validator(this, args); if (args.Cancel) { e.Cancel = true; _errorProviderText.SetError(InputTextBox, args.Message); } } }
private static void InputBox_Validating(object sender, InputBoxValidatingEventArgs e) { if (String.IsNullOrEmpty(e.Text.Trim())) { e.Cancel = true; e.Message = "Required"; } }