Results 1 to 5 of 5

Thread: input mask

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Exclamation input mask

    how do you make input masks for things like phone numbers and social security numbers?
    Last edited by citizenstitch; May 25th, 2005 at 01:35 PM.

  2. #2
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: input mask

    you could use regular expressions http://www.regular-expressions.info/tutorial.html

    Here is one for a email address \b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b

    Matching Vaild dates 19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])

    usage example

    VB Code:
    1. Dim x as New System.Text.RegularExpressions.RegEx("\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b)
    2.  
    3. Msgbox(x.Match("[email protected]"))
    4. Msgbox(x.Match("aInvaildEmail2woot.ca"))
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Re: input mask

    how do i make this check a textbox? great post by the way. it took me awhile to understand the code but the website helped.

  4. #4
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: input mask

    VB Code:
    1. Dim x as New System.Text.RegularExpressions.RegEx("\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b")  
    2.  
    3. If x.Match(TextBox1.Text) Then
    4.     Msgbox("Vaild Email!")
    5. Else
    6.     Msgbox("Invaild Email!")
    7. End if
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Re: input mask

    it underlines x.Match(TextBox1.Text) and says it can not be converted to boolean
    Attached Images Attached Images  
    Last edited by citizenstitch; May 25th, 2005 at 12:36 PM.

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