1
Private Sub txtPName_KeyPress(KeyAscii As Integer) If (KeyAscii > 64 And KeyAscii < 91) Or (KeyAscii > 96 And KeyAscii < 123) Then text1 = text1 Else KeyAscii = o Beep MsgBox "Valid Characters are " + " a To z and A To Z only" End If End Sub Private Sub txtPSurname_KeyPress(KeyAscii As Integer) Select Case Chr(KeyAscii) Case 0 To 9 KeyAscii = 0 End Select End Sub

Private Sub TxtPName Keypress Validation

Embed Size (px)

DESCRIPTION

Keypress validation

Citation preview

Private Sub txtPName_KeyPress(KeyAscii As Integer)If (KeyAscii > 64 And KeyAscii < 91) Or (KeyAscii > 96 And KeyAscii < 123) Thentext1 = text1ElseKeyAscii = oBeepMsgBox "Valid Characters are " + " a To z and A To Z only"End IfEnd Sub

Private Sub txtPSurname_KeyPress(KeyAscii As Integer) Select Case Chr(KeyAscii) Case 0 To 9 KeyAscii = 0 End Select

End Sub