VALIDATES DATA ENTRY IN TEXT BOXES CRITICAL IN BUSINESS ENVIRONMENT
VALIDATES DATA ENTRY IN TEXT BOXES CRITICAL IN BUSINESS ENVIRONMENT
Rate VALIDATES DATA ENTRY IN TEXT BOXES CRITICAL IN BUSINESS ENVIRONMENT
(1(1 Vote))
Private Sub text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 46 Then
KeyAscii = 0
End If
If Chr(KeyAscii) Like "#" <> True And KeyAscii <> vbKeyBack And KeyAscii <> vbKeyDelete Then
KeyAscii = 0
End If
End Sub
'* The following code allows only numbers and letters
Private Sub text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 46 Then
KeyAscii = 0
Exit Sub
End If
If ((KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = vbKeyDelete) Or (KeyAscii = vbKeyBack)) <> True Then
KeyAscii = 0
End If
End Sub
'* The following code allows only alphabets
Private Sub text1_KeyPress( KeyAscii As Integer)
If KeyAscii = 46 Then
KeyAscii = 0
Exit Sub
End If
If Chr(KeyAscii) Like "[a-zA-Z]" <> True And KeyAscii <> vbKeyBack And KeyAscii <> vbKeySpace And KeyAscii <> vbKeyDelete Then
KeyAscii = 0
End If
end sub
'* The following code allows only numbers and "-"
private sub text1_keypress(keyascii as integer)
If KeyAscii = 46 Then
KeyAscii = 0
Exit Sub
End If
If Chr(KeyAscii) Like "#" <> True And KeyAscii <> Asc("-") And KeyAscii <> vbKeyBack And KeyAscii <> vbKeyDelete And KeyAscii <> vbKeySpace Then
KeyAscii = 0
End If
End Sub
'* The following code allows only one decimal point
Private Sub text1_KeyPress(KeyAscii As Integer)
Static dotentered As Boolean
If InStr(txtper, ".") > 0 Then
dotentered = True
Else
dotentered = False
End If
If KeyAscii = 46 And dotentered Then
KeyAscii = 0
Exit Sub
End If
If Chr(KeyAscii) Like "#" <> True And KeyAscii <> vbKeyBack And KeyAscii <> vbKeyDelete Then
keyAscii = 0
End If
End Sub
VALIDATES DATA ENTRY IN TEXT BOXES CRITICAL IN BUSINESS ENVIRONMENT Comments
No comments yet — be the first to post one!
Post a Comment