how to validate email field and website field. Means, in email @ and . is compulsory
and in website www and . is compulsory, something like this

Recommended Answers

All 6 Replies

Why not use InStr?

If InStr(Email$, "@") > 0 Then 'Valid Email Format

If UCase$(Left$(Website$, 4))="WWW." then 'valid web format

If UCase$(Left$(Website$, 11))="HTTP://WWW." then 'valid web format

thnx for reply.

suppose some one enter "abcd@abcd"
without entering ".com / .org / .net" then how to validate?

Well, you'll have to check for thsoe as well. But what's to prevent someone from entering "" as a bogus address? There's really no way to validate legitimate addresses. I would check for the presence of an @ sign and a period in the input, and assume they typed a legitimate address.

that is ok. but,
if some does not enter .(dot) and rest part. i.e. "no@" insted of
then how to validate? that is my problem

and by the way for @, InStr working properly

Check for both...

If InStr(Email$, "@") > 0 AND InStr(Email$, ".") > 0 Then
'Valid Email Format
else 'not valid
end if

commented: helpful person upto the last query +1

thnx for solutions

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.