长发q版人物丸子头:如何在VB中使TEXTBOX只能输入数字,并支持Ctrl+V粘贴?
来源:百度文库 编辑:高考问答 时间:2024/05/03 20:28:40
使TEXTBOX只能输入数字:
Private Sub Text1_Change()
Dim i As Integer
For i = 1 To Len(Text1.Text)
If IsNumeric(Mid(Text1.Text, i, 1)) Then
bIsNum = True
Else
bIsNum = False
End If
Next i
If bIsNum = True Then
'MsgBox "是数字"
Else
Text1.Text = ""
'MsgBox "不是数字"
End If
End Sub