Click here to Skip to main content
15,891,607 members
Articles / Desktop Programming / WPF

Email Address Validation: Explained in Detail, Code for Production Quality WPF TextBox

Rate me:
Please Sign up or sign in to vote.
3.95/5 (8 votes)
30 Mar 2020Public Domain11 min read 18.8K   10  
A WPF TextBox which can validate email addresses depending on your needs, plus detailed description of the many ways a valid email address may look like.
Validating email addresses is difficult, because the specification what constitutes a valid email address allows for an immense variety. Trying to translate these specifications into proper Regex leads to huge and complicated expressions which still might not cover all cases. This article describes how email address validation can be reasonably done and provides a production quality code WPF TextBox, including letting the user enter only valid keystrokes, controlling if an email address must be entered (Required field) and alerting the user if he tries to close the window without saving the changes made.

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Software Developer (Senior)
Singapore Singapore
Retired SW Developer from Switzerland living in Singapore

Interested in WPF projects.

Comments and Discussions