你可以按下面方法自行扩展应用
'限制只能输入0-9数字和小数点、退格、回车键
Function LimitCurrency(ByRef tmpCode As Integer)
If InStr("0123456789.-" & Chr(8) & Chr(13), Chr(tmpCode)) <= 0 Then
tmpCode = 0
End If
End Function
调用方法举例:
Private Sub Text1_KeyPress(KeyAscii As Integer)
LimitCurrency KeyAscii
End Sub