?
Solved

Validating an e-mail address

Posted on 2001-06-04
6
Medium Priority
?
176 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Accepted Solution

by:
Ninibini earned 280 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 53

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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