Results 1 to 3 of 3

Thread: how to validate email in a text box

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    11

    Post

    hi..
    i am a basic vb learner.. i have a problem about the email validation.. actually inside my program have atext box who let user to key in email.. but some of the invalid field like double "@" in a field or "@clouclck.com" and have alot of invalid field.. so. can somebody help me to fix this validation by showing me source code.. i will appreciate it.. thx.. hope hear from u soon..!

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Post

    Hi cloudlck,

    Here's some email validation code. I included everything I could think of that would need to be in an email address. However, you should easily be able to add more validation after checking out the code below.

    In order to try it out, create a new project with a text box and a command button.
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
        If Text1 = "" Or Left(Text1, 1) = "@" Or InStr(Text1, "@") = 0 Or UCase(Right(Text1, 3)) <> "COM" Or InStr(Text1, "@@") > 0 Then
            MsgBox "Invalid Email Address.", vbCritical, "Try Again."
            Text1.SetFocus
        Else
            MsgBox "Valid Email Address."
        End If
    End Sub
    All the best.

    ------------------
    OneSource
    The truth may be out there, but it's in here too!
    .


    [This message has been edited by OneSource (edited 01-29-2000).]

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    11

    Post

    thanks one source... the code is work on my module.. thx.. nice to meet you..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width