How to allow only number and only one occurence of decimal character in text box
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 | 'Controls - How to allow only number and only one occurence of decimal character in text box Private Sub Text1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case Is < 32 ' Control keys are OK. Case 46 If InStr(1, Text1.Text, ".") <> 0 Then KeyAscii = 0 Case 48 To 57 ' This is a digit. Case Else ' Reject any other key. KeyAscii = 0 End Select End Sub |