Results 1 to 5 of 5

Thread: VB.NET: Checking Email Address and Handphone number

  1. #1

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    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

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: VB.NET: Checking Email Address and Handphone number

    VB Code:
    1. 'inputEmail is the string that was input
    2. 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})(\]?)$"
    3. Dim re As Regex = New Regex(strRegex)
    4. If re.IsMatch(inputEmail) Then
    5.  'continue
    6. Else
    7.  MessageBox.Show("Invalid Email address!!")
    8. End If

    This example uses RegEx. Very useful for validations.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: VB.NET: Checking Email Address and Handphone number

    Write a regular expression for your handphone verification too.

    As for Q3, separate the two.

  4. #4

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    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

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: VB.NET: Checking Email Address and Handphone number

    Quote 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
  •  



Click Here to Expand Forum to Full Width