熱心網友

此題在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碼是不是在數字之間