Solved

Validating an e-mail address

Posted on 2001-06-04
6
173 Views
Last Modified: 2012-05-04
Hi,

I was wondering if anyone has any quick routines on validating e-mail addresses in VB, ie., checking there is one @, at least one '.', no spaces etc.

Any help would be greatly appreciated.

Ben
0
Comment
Question by:Bennie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:vim_asteya
ID: 6155206
u can use the instr function.
I did the validation using this function
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6155208
If strEmail like "*@*.*" and Instr(1,strEmail," ") = 0 Then
  'email seems valid
End If

0
 
LVL 1

Expert Comment

by:vim_asteya
ID: 6155211
Dim v1, v2
If Len(email.Text) = 0 Then
    DoEvents
ElseIf Len(email.Text) > 0 Then
    v2 = (InStr(1, email.Text, "@", vbTextCompare))
    v1 = (InStr(1, email.Text, ".", vbTextCompare))
       
        If ((v2 > 0) And (v1 > 0)) Then
            DoEvents
        Else
            MsgBox "Invalid ID", , "Email"
            email.SetFocus
            email.Text = ""
        End If
End If
try this,it worked for me
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Accepted Solution

by:
Ninibini earned 70 total points
ID: 6155217
check out
http://161.58.186.98/misc/tip519.html
at vb-world.net
the have a sample posted on their site.

0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 6155241
0
 

Author Comment

by:Bennie
ID: 6155257
Thanks very much everyone for suggestions. This one seems to have worked out the best.

Ben
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question