I can't work out what i've done wrong here, why is it telling me there is unreachable code on the "if" in this:
Any ideas?Code://Check email address entered is valid public class RegexUtilities { public static bool IsValidEmail(string sEmailRecipient) { // Return true if sEmailRecipient is in valid e-mail format. return Regex.IsMatch(sEmailRecipient, @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"); if (RegexUtilities.IsValidEmail(sEmailRecipient)) MessageBox.Show("Valid = " + sEmailRecipient); else MessageBox.Show("Inalid = " + sEmailRecipient); } }
Thank you.




Reply With Quote