DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: alphanumeric check

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    alphanumeric check

    [Originally posted by asim srivastava]

    Hi FreeVBcode!

    Thanks for your timely help.I just need one more feature added to your code whch you gave me to check for alphanumeric input.
    Following is your code.
    =================================================
    Just change the if Check to

    If Not (sChar Like &quot;[0-9a-zA-Z]&quot;) and sChar <> &quot; &quot; Then

    In case other users are interested, here is the original code:


    Dim sChar As String
    Dim lLen as Long
    Dim lCtr as Long

    lLen = Len(Text1.Text)

    For lCtr = 1 to lLen

    sChar = Mid(Text1.Text, lCtr, 1)
    If Not (sChar Like &quot;[0-9a-zA-Z]&quot;) Then
    &nbsp; msgBox &quot;Input must be alphanumeric&quot;
    &nbsp; Text1.Text = &quot;&quot;
    &nbsp; Exit For
    End If

    Next
    End Sub
    ==============================================
    Feature:
    When an invalid entry is made and an error is displayed in a msgbox.I want that when I click on the ok button of the error msgbox the VB form with the text box should disappear.

    Once again..&quot;FreeVBcode&quot; Thankyou very much for all your help.

    Thanks and Regards,


  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:alphanumeric check

    [Originally posted by FreeVBCode.com]

    If Not (sChar Like "[0-9a-zA-Z]") Then
    msgBox "Input must be alphanumeric"
    Me.Hide
    Text1.Text = ""
    Exit For
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center