Emps-World Forum

Miscellaneous => Computers and Technology => Topic started by: Knight Night on March 21, 2016, 04:39:51 pm

Title: Writing e-mail with #C
Post by: Knight Night on March 21, 2016, 04:39:51 pm
Hello,

So if anyone can help me with this it would be really appreciated, so basically a user will be asked to write his e-mail address, and if there's a mistake by the e-mail form, it should ask him back to re-type it
example for a complier:
Type your e-mail address:
naseem1@hotmailcom
invalid input, please try again.
naseem1@hotmail.com
press any key to....

Thanks.
Title: Re: Writing e-mail with #C
Post by: Kaarel 123 on March 24, 2016, 08:55:39 pm
I think the easiest way would be to check if the email is containing an at sign (@) and a dot (.). Do you need specific code or is the logic enough for you?
Title: Re: Writing e-mail with #C
Post by: Knight Night on March 25, 2016, 06:26:00 pm
I think the easiest way would be to check if the email is containing an at sign (@) and a dot (.). Do you need specific code or is the logic enough for you?

I'd understand what you referring for but could you show me a specific code if you can, and thanks.
Title: Re: Writing e-mail with #C
Post by: Kaarel 123 on March 27, 2016, 08:43:30 am
Put this under a button click code

Code: [Select]
if(textbox.Text.Contains(.) && textbox.Text.Contains(@) && textbox.Text.Length > 0){
Correct email}
else{Incorrect email}

You'll have to change 'textbox' to the textbox that the email will be written in.