|
-
February 20th, 2000, 12:11 PM
#1
Format text
How to check if string is in e-mail format and if it's not then text1 = "" when text1 lost focus
-
February 21st, 2000, 12:46 AM
#2
Re: Format text
Add folowing code to your form:
private sub text1_lostfocus()
dim intPos as string
dim isEmail as boolean
isEmail = false
'check for @ in text1 and get its position
intpos = instr(text1.text,"@")
if intpos > 0 then
' if there is a @ in the text
if instr(intPos,text1.text,".") > 0 then
'if there is a . after the @
isEmail = true
end if
end if
if not(isEmail) then
' if not a valid email
text1.text = ""
end if
End sub
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
February 21st, 2000, 06:33 AM
#3
Re: Format text
An even easier way :
If Text1.Text Like "*@*.*" then
MsgBox "OK"
else
MsgBox "not ok"
End If
- I must remember to start using the Like command more often!
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
February 21st, 2000, 06:52 AM
#4
Re: Format text
me 2
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
February 21st, 2000, 02:55 PM
#5
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
|