+ Reply to Thread
Results 1 to 6 of 6

Thread: Easy Email Validation

  1. #1
    Join Date
    Jun 2007
    Location
    Kosovo
    Posts
    660
    Rep Power
    23

    Easy Email Validation

    Hi All today i will show you a Funtion a made to validate email addresses in a string ok im not good at making tutorials so i hope you understand the most

    ok the funtion looks like this


    HTML Code:
    Public Function ValEmail(mail As String)
    If Left(mail, 1) = "@" Then
    GoTo NotValide
    ElseIf Right(mail, 1) = "@" Then
    GoTo NotValide
    ElseIf InStr(1, mail, "@") = False Then
    MsgBox "The @ is Missing!"
    ElseIf InStr(1, mail, ".") = False Then
    GoTo NotValide
    ElseIf Right(mail, 1) = "." Then
    GoTo NotValide
    ElseIf Left(mail, 1) = "." Then
    GoTo NotValide
    
    'Not Valide
    NotValide:
    MsgBox "This is Not a Valide Email Address!"
    End If
    End Function

    first part of the funtion like u see is

    Code:
    If Left(mail, 1) = "@" Then
    GoTo NotValide
    So this part looks for the @ on the first place of the string if the string is in the format @somthing
    then its not valide so that the funtion calls the goto funtion and moves to NotValide


    Next Part like you see is

    Code:
    ElseIf Right(mail, 1) = "@" Then
    GoTo NotValide
    its the same as above but this looks from the right if the first char is a @ its again a Invalide Email and again
    we call goto

    Next Part is

    Code:
    ElseIf InStr(1, mail, "@") = False Then
    MsgBox "The @ is Missing!"
    This is a easy if stament we use the instr funtion to make a bool statment dont know the right word for it
    in english hope you know what i mean so if the instr funtion returns false we know that the @ is missing
    and this is again not a valide email address and we then call a msgbox to tell that the @ is missing

    Next Part is

    Code:
    ElseIf InStr(1, mail, ".") = False Then
    GoTo NotValide
    This is again a bool statment that looks for what the funtion returns if instr funtion returns false
    we know that a . is missing so its not a valide email address if instr returns a true the . is present so it
    an valide email **** im not good at making tutorials anyway lets continue

    Next Part is

    Code:
    ElseIf Right(mail, 1) = "." Then
    GoTo NotValide
    ElseIf Left(mail, 1) = "." Then
    GoTo NotValide
    ive combined both statments here this do just like the first and second part in the tutorial it looks if the first from
    right or first from left is a . if yes its not a valide email address.

    last part is

    Code:
    NotValide:
    MsgBox "This is Not a Valide Email Address!"
    End If
    This is the error code in case @ is first symbol from left or right or . is first symbol from left or right

    Ok wow i never make a tutorial ok this funtion is just a basic one did it within 10 minutes but thought its
    worth to post it Copyright of this Funtion NanoXcore thats me with dren,egzon,elban,limi

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Easy Email Validation

    Nice job. +rep
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Join Date
    Jun 2007
    Location
    Kosovo
    Posts
    660
    Rep Power
    23

    Re: Easy Email Validation

    I forggot to tell how to use the funtion ok like u see we have an a declaration and also a request we declare
    (mail As String) mail as string and also request it so to use it simply use this example

    ValEmail(text1.text)

  5. #4
    Jordan Guest

    Re: Easy Email Validation

    Very nice! +rep.

  6. #5
    Join Date
    Sep 2008
    Location
    Kosovo
    Posts
    4,032
    Rep Power
    44

    Re: Easy Email Validation

    nice one bro .. and +rep indeed ..

  7. #6
    Join Date
    Nov 2008
    Location
    Kosovo.
    Posts
    2,391
    Rep Power
    30

    Re: Easy Email Validation

    Great Job .. +rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP Validation
    By Alex_j in forum PHP Development
    Replies: 3
    Last Post: 04-27-2010, 08:51 AM
  2. Email Validation
    By phpforfun in forum Classes and Code Snippets
    Replies: 9
    Last Post: 03-24-2010, 08:20 AM
  3. Reading email from external email account
    By amrosama in forum PHP Development
    Replies: 5
    Last Post: 01-25-2010, 07:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

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