热心网友
此题在VB栏目中也有,可用下面代码可实现:Private Sub Form_Load() Text1= ""End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii Asc("9") Then KeyAscii = 0 '取消字符。 Beep '发出错误信号。 End IfEnd Sub输入含小数数字,代码如下:Private Sub Form_Load()Text1 = ""End SubPrivate Sub text1_KeyPress(KeyAscii As Integer) If KeyAscii Asc("。") Or KeyAscii Asc("9") And KeyAscii Asc("。") Or KeyAscii = Asc("/") Then KeyAscii = 0 '取消字符。 End IfEnd Sub。
热心网友
可以判断输入字符的ASSIC码是不是在数字之间