[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

Validating an e-mail address

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
Bennie
Asked:
Bennie
1 Solution
 
vim_asteyaCommented:
u can use the instr function.
I did the validation using this function
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
If strEmail like "*@*.*" and Instr(1,strEmail," ") = 0 Then
  'email seems valid
End If

0
 
vim_asteyaCommented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
NinibiniCommented:
check out
http://161.58.186.98/misc/tip519.html
at vb-world.net
the have a sample posted on their site.

0
 
Ryan ChongCommented:
0
 
BennieAuthor Commented:
Thanks very much everyone for suggestions. This one seems to have worked out the best.

Ben
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now