|
-
Jan 30th, 2005, 04:35 AM
#1
Thread Starter
Addicted Member
VB.NET: Checking Email Address and Handphone number
I have 3 questions regarding checking handphone and email address
1) Say i enter helloy.yahoo.com to the textbox, how to check whether it is
a valid email address when i click on a button to send...
2) Same situation as the above, how to check whether the the user key in
the correct handphone number and length...
3) If the above two questions can be achieved, can it be possible to check
both email and handphone in one textbox when the user key in either
handphone or email...or is t better to spilt the textbox..
Thanks
-
Jan 30th, 2005, 04:40 AM
#2
Re: VB.NET: Checking Email Address and Handphone number
VB Code:
'inputEmail is the string that was input
Dim strRegex As String = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" + "\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + ".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
Dim re As Regex = New Regex(strRegex)
If re.IsMatch(inputEmail) Then
'continue
Else
MessageBox.Show("Invalid Email address!!")
End If
This example uses RegEx. Very useful for validations.
-
Jan 30th, 2005, 04:42 AM
#3
Re: VB.NET: Checking Email Address and Handphone number
Write a regular expression for your handphone verification too.
As for Q3, separate the two.
-
Jan 30th, 2005, 09:01 AM
#4
Thread Starter
Addicted Member
Re: VB.NET: Checking Email Address and Handphone number
how you see regular expression works...
Can you teach me how to see....
take your previous email as example..
I want to do it for handphone also..
Thanks
-
Jan 30th, 2005, 09:19 AM
#5
Re: VB.NET: Checking Email Address and Handphone number
 Originally Posted by toytoy
Can you teach me how to see....
<philosophical>It is you who must open your eyes and see, young one...</philosophical>
RegEx tutorial
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
|