public static Boolean checkEmail(String emailValue) { String[] splitValueList = emailValue.Split('@'); if (emailValue.Contains("@") && splitValueList[0].Length > 0 && splitValueList[1].Length > 0) { if (!ValidateInsertValue.hasSpecialChar(splitValueList[0]) && !ValidateInsertValue.hasSpecialChar(splitValueList[1]) && splitValueList[1].Contains(".")) { return(true); } else { return(false); } } else { return(false); } }
private void tbAltEmail_TextChanged(object sender, EventArgs e) { String emailValue = this.tbEmail.Text; flag = ValidateInsertValue.checkEmail(emailValue); if (flag == true) { lbAltEmailvalidate.Text = "Correct"; hasError = false; } else { if (this.tbEmail.Text != "") { lbAltEmailvalidate.Text = "Invalid Email"; } else { lbAltEmailvalidate.Text = ""; } hasError = true; } }
//NRIC private void tbNRIC_TextChanged(object sender, EventArgs e) { flag = false; flag = ValidateInsertValue.isValidSgFin(this.tbNRIC.Text); if (flag == true) { lbNRICvalidate.Text = "Correct NRIC"; hasError = false; } else { if (this.tbNRIC.Text != "") { lbNRICvalidate.Text = "Wrong NRIC"; } else { lbNRICvalidate.Text = ""; } hasError = true; } }
//phoneNo private void tbPhoneNum_TextChanged(object sender, EventArgs e) { flag = false; String phoneValue = this.tbPhoneNum.Text; flag = ValidateInsertValue.checkphoneNo(phoneValue); if (flag == true) { lbPhoneNovalidate.Text = "Correct"; hasError = false; } else { if (this.tbPhoneNum.Text != "") { lbPhoneNovalidate.Text = "Invalid Number"; } else { lbPhoneNovalidate.Text = ""; } hasError = true; } }