Advertisement
Guest User

Untitled

a guest
May 21st, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public bool ValidEmailAddress(string emailAddress)
  2. {
  3. // Confirm that the email address is not empty.
  4. if (emailAddress.Length == 0)
  5. {
  6. MessageBox.Show("Please, enter your email");
  7. return false;
  8. }
  9.  
  10. // Confirm that there is an "@" and a "." in the email address, and in the correct order.
  11. if (emailAddress.IndexOf("@") > -1)
  12. {
  13. if (emailAddress.IndexOf(".", emailAddress.IndexOf("@")) > emailAddress.IndexOf("@"))
  14. return true;
  15. }
  16. MessageBox.Show("Invalid input format of email! "+
  17. "Example: 'someone@example.com' ");
  18. return false;
  19.  
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement