Private Sub Text1_Change()
If Text1.Text < 0 Or Text1.Text > 1 Then
MsgBox "只能输入0到1之间的数字"
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 8
Case 46
If InStr(Text1, ".") <> 0 Then KeyAscii = 0
Case 47 To 57
Case Else
KeyAscii = 0
End Select
End Sub
温馨提示:答案为网友推荐,仅供参考