VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function to validate and allow only Alpha Numeric - not allowing to enter Special characters

by Raghuraja. C (21 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 17th February 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function to validate and allow only Alpha Numeric - not allowing to enter Special characters

Rate Function to validate and allow only Alpha Numeric - not allowing to enter Special characters



Private Sub txtAlphNumeric_KeyPress(KeyAscii As Integer)
    KeyAscii = fnAlfaChk(KeyAscii)
End Sub

'to allow the dbl data input
Public Function fnAlfaChk(keyAsc As Integer) As Integer
    If keyAsc = 8 Then
        fnAlfaChk = keyAsc
        Exit Function
    End If
    If InStr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+_*?><| ", Chr(keyAsc)) <> 0 Then
        fnAlfaChk = keyAsc
    Else
        fnAlfaChk = 0
    End If
End Function

Download this snippet    Add to My Saved Code

Function to validate and allow only Alpha Numeric - not allowing to enter Special characters Comments

No comments have been posted about Function to validate and allow only Alpha Numeric - not allowing to enter Special characters. Why not be the first to post a comment about Function to validate and allow only Alpha Numeric - not allowing to enter Special characters.

Post your comment

Subject:
Message:
0/1000 characters