Prevents special characters from being entered into a textbox
Prevents special characters from being entered into a textbox
Rate Prevents special characters from being entered into a textbox
(2(2 Vote))
'Private Sub txtLastName_KeyPress(KeyAscii As Integer)
'KeyAscii = Prevent_Special_Chars(KeyAscii)
'End Sub
'function can be adjusted to allow/disallow any values you want
Public Function Prevent_Special_Chars(KeyAscii As Integer) As Integer
'prevents a user from entering a special characters and numbers into a control from where the function is called
If (KeyAscii >= 33 And KeyAscii <= 64) Or (KeyAscii >= 91 And KeyAscii <= 96) Or (KeyAscii >= 123 And KeyAscii <= 126) Then
Prevent_Special_Chars = 0
Else
Prevent_Special_Chars = KeyAscii
End If
End Function
Prevents special characters from being entered into a textbox Comments
No comments yet — be the first to post one!
Post a Comment