by Javed Jabbar (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
Allow only numbers along with one deciaml.
'***********************************************************
' This code only allows numbers along with one decimal
' point in text box named txtNumber. Also allow backspace.
'***********************************************************
If KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Or KeyAscii = 46 Then
If KeyAscii = 46 Then
If InStr(txtNumber.Text, ".") Then
KeyAscii = 0
Exit Sub
Else
txtNumber.Text = txtNumber.Text
End If
Else
End If
Else
KeyAscii = 0
End If