ä½ä¸è®©ææ¬æ¡åªæ¥åæ°åå¢ï¼è¿æ ·ä¸æ¯æ´åçä¸ç¹ãå®ç°æ¹æ³å¦ä¸ï¼ Public Function ImportNum(KeyIn As Integer, ValidateString As String, Editable As Boolean) As Integer
Dim ValidateList As String
Dim KeyOut As Integer
If Editable = True Then
ValidateList = UCase(ValidateString) & Chr(8)
Else
ValidateList = UCase(ValidateString)
End If
If InStr(1, ValidateList, UCase(Chr(KeyIn)), 1) > 0 Then
KeyOut = KeyIn
Else
KeyOut = 0
Beep
End If
ImportNum = KeyOut
End Function 'å½æ°ImportNum使ç¨æ¹æ³Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = ImportNum(KeyAscii, "0123456789" & Chr(13), True) 'Chr(13)代表å车
End Sub 使ç¨è¯¥å½æ°ä½¿å¾TEXTBOXåªè½è¾å
¥ä½ æå®çå¼ã
温馨提示:答案为网友推荐,仅供参考