private bool HasValue(TextBox textBox, Label label, CancelEventArgs e)
        {
            ValidationResult result = FieldValidator.HasValue(textBox, label);

            _errorProvider.SetError(label, result.Message);
            e.Cancel = !result.Succeeded;
            return(result.Succeeded);
        }
Esempio n. 2
0
        private void SetError(TextBox textBox, Label label, CancelEventArgs e)
        {
            string errorMessage = null;

            if (FieldValidator.HasValue(textBox, label) != ValidationResult.Success)
            {
                errorMessage = $"{label.Text} must have a value";
            }

            _errorProvider.SetError(label, errorMessage);
            e.Cancel = (errorMessage != null);
        }
 /// <summary>
 /// Validates the values Input by user in Configuration Control
 /// </summary>
 /// <returns></returns>
 public PluginValidationResult ValidateConfiguration()
 {
     return(new PluginValidationResult(FieldValidator.HasValue(AlertTextBox, "Alert message")));
 }
Esempio n. 4
0
 private void textBox_Username_Validating(object sender, CancelEventArgs e)
 {
     SetError(FieldValidator.HasValue(textBox_Username, label_Username) == ValidationResult.Success, label_Username, e);
 }