C# 2.0 Masked Text Box and Validating E-mails

O

orekinbck

Hi There

I have spent alot of time trying to get a masked text box to validate
e-mails, but with no success. Mainly because I can't figure out how to
account for the wide variety of different e-mail addresses, for
example:
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

In the end I used a standard text box with a lenient regular expression
to validate it.

Is that the right appraoch or can I get e-mails working with Masked
Text Boxes?

TIA
Bill
 
M

Maddly Balet

(30 Jul 2005 23:14:00 -0700), (e-mail address removed) :
I have spent alot of time trying to get a masked text box to validate
e-mails, but with no success. Mainly because I can't figure out how to
account for the wide variety of different e-mail addresses, for
example:
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

Using a MaskedTextBox for email entry is not a good idea. This
component is at his best when it deals with hard-formatted
expressions, like a zipcode or a date.
In the end I used a standard text box with a lenient regular expression
to validate it.

Is that the right appraoch or can I get e-mails working with Masked
Text Boxes?

Yes, you should use a TextBox (with an ErrorProvider component if you
like it). Here is a pretty good regex to validate emails :

"^[^@]+@([-\\w]+\\.)+[A-Za-z]{2,4}$"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top