Windows Phone Developers

Tuesday, May 6, 2008

Validate eMail Addresses using VB.NET Function

Detect errors in email addresses using .NET exception handling

There are n-number of ways to detect errors in email addresses; some use regular expressions to do that. The same has been built as a check in ASP.NET validation controls.

The following function uses the Try-Catch exception handling by assigning the address to the mail message. If the format of the email address is found to be wrong, then the function returns false. A simple one; please post your comments on the way it worksJ

Function Detect_MailAddress_Errors(ByVal sMailAdd As String) As Boolean


Dim oMailMsg As New MailMessage


Return True

'Format Exceptions

Catch exFormat As FormatException

'MsgBox("Format Error")

Return False

' General Exceptions

Catch ex As Exception

End Try

End Function

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon


  1. Also consider this free component:

  2. I found this library for verifying email addresses in .net: