# Re: 如何限制在Text Box 中只能输入数字及小数点 ??? (无内文)

Posted by Fai on August 12, 1999 at 17:16:56:

In Reply to: 如何限制在Text Box 中只能输入数字及小数点 ??? (无内文) posted by 小小 on August 12, 1999 at 16:48:51:

: ...

Public Sub ValidateNumber(KeyAscii As Integer)
Dim strValid As String
strValid = "0123456789." & Chr(8)
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
Call ValidateNumber(KeyAscii)
End Sub

Follow Ups:

- 谢谢! (无内文) 小小 09:58:40 8/13/99 (0)