|
-
Dec 29th, 1999, 01:27 AM
#3
Thread Starter
Member
Private Function IsEmail(email As String) As Boolean
Dim firstAt As Integer
Dim firstDot As Integer
firstAt = InStr(1, email, "@")
firstDot = InStr(1, email, ".")
If firstAt > 0 And firstDot > 0 Then
'Check for other "@"
If InStr(firstAt + 1, email, "@") > 0 Then
IsEmail = False
Exit Function
Else
'Check for other "."
If InStr(firstDot + 1, email, ".") > 0 Then
IsEmail = False
Exit Function
End If
End If
IsEmail = True
Else ' "@" or "." is missing
IsEmail = False
End If
End Function
U can takecare of empty text before pass to the function.
ex) if Len(text1) = 0 then
msgbox "No input"
text1.Setfocus
else
if not IsEmail(text1) then _
MsgBox "Wrong format!"
end if
Joon
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|