Validation using Validating event and ErrorProvider – Show Error Summary

You should first correct your validating events this way: private void textBox1_Validating(object sender, CancelEventArgs e) { Regex regex1 = new Regex(@”^[a-zA-Z]+$”); if (!regex1.IsMatch(textBox1.Text)) { //To set validation error errorProvider1.SetError(textBox1, “Nosaukums nedrīskt saturēt ciparus!”); //To say the state of control in invalid e.Cancel = true; } else { //To clear the validation error this.errorProvider1.SetError(this.textBox1, “”); } … Read more