Textbox validation in vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prathap
    New Member
    • Nov 2011
    • 37

    Textbox validation in vb.net

    I had used this code to validate email id in textbox,but it is not working properly pls help me. thanks in advance

    Code:
    Dim Expression As New System.Text.RegularExpressions.Regex("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")
    If Expression.IsMatch(Textbox1.Text) Then
    MsgBox("The email address is valid.")
    Else
    MsgBox("The email address is NOT valid.", MsgBoxStyle.Critical, "Invalid Mail ID")
    Exit Sub
    End If
  • Ammu
    New Member
    • Aug 2011
    • 78

    #2
    Actually your code is correct
    I just copy your code into my page and run its working

    Comment

    • Prathap
      New Member
      • Nov 2011
      • 37

      #3
      Its working,that was my mistake.thanks for your response.

      Comment

      Working...