读书人

文本框限制了只能输入数字但小数点输

发布时间: 2012-01-20 18:53:53 作者: rapoo

文本框限制了只能输入数字,但小数点输入不了
请问如何解决这个问题?谢

[解决办法]
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) Like "[0-9.] " Or KeyAscii < 32) Then KeyAscii = 0
End Sub

[解决办法]
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 then
Text1.SelStart=0
Text1.SelLength=Len(Text1.Text)
endif
End Sub

读书人网 >VB

热点推荐