IsNumeric




'Se Text1 e' il campo da controllare:

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not_Numeric(KeyAscii) Then KeyAscii = 0
End Sub

Function Not_Numeric(ValAscii As Integer) As Integer
Not_Numeric = False
If ValAscii = vbKeyBack Or ValAscii = vbKeyTab Or ValAscii = vbKeyReturn Then Exit Function
If ValAscii < 48 Or ValAscii > 57 Then ' Cifre 0 e 9.
Beep
Not_Numeric = True
End If
End Function











( isnumeric.html )- by Paolo Puglisi - Modifica del 17/12/2023