Results 1 to 3 of 3

Thread: validate alpha/numeric syntax *resolved"

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2003
    Location
    Leeds
    Posts
    24

    validate alpha/numeric syntax *resolved"

    How do i write this in VB....??

    "only numeric keys to be entered into my field....and vice versa....how do i allow only alpha keys to be entered into my field..."

    tia

    --------------------------
    THANKS
    Last edited by kmcb; Nov 22nd, 2004 at 07:11 AM.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You could use a regular expression to do it, but the easiest would be just simply use IsNumeric()
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    well if your using a textbox then you could go,

    VB Code:
    1. Private Sub Text1_KeyPress(KeyAscii As Integer)
    2.  
    3.     If Not (KeyAscii < 48 Or KeyAscii > 57) Then
    4.         KeyAscii = 0
    5.     End If
    6.  
    7. End Sub

    for no numeric values to be entered and remove the NOT for vice versa

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