private void ValidateControls() { if (string.IsNullOrWhiteSpace(tbLastName.Text)) { epLastName.SetError(tbLastName, "Pole 'Nazwisko' jest wymagane.\n"); } else { epLastName.Clear(); } if (string.IsNullOrWhiteSpace(tbFirstName.Text)) { epFirstName.SetError(tbFirstName, "Pole 'Imię' jest wymagane."); } else { epFirstName.Clear(); } if (!string.IsNullOrWhiteSpace(tbPesel.Text) && !ValidatorHelper.IsValidPESEL(tbPesel.Text)) { epPesel.SetError(tbPesel, "Liczba cyfr dla numeru pesel jest nieprawidłowa."); } else { epPesel.Clear(); } }
private void tbPesel_Validated(object sender, EventArgs e) { string pesel = tbPesel.Text; if (!string.IsNullOrWhiteSpace(pesel) && !ValidatorHelper.IsValidPESEL(pesel)) { epPesel.SetError(tbPesel, "Liczba cyfr dla numeru pesel jest nieprawidłowa."); } else { epPesel.Clear(); } }
private void txtPESEL_Validated(object sender, EventArgs e) { string PESEL = txtPESEL.Text; if (!string.IsNullOrWhiteSpace(PESEL) && !ValidatorHelper.IsValidPESEL(PESEL)) { epPESEL.SetError(txtPESEL, "Cyfra kontrolna nr PESEL jest nieprawwidłowa"); } else { epPESEL.Clear(); } }