宿迁广电大厦:如何在VB中使TEXTBOX只能输入数字,并支持Ctrl+V粘贴?
来源:百度文库 编辑:杭州交通信息网 时间:2024/05/09 17:59:36
使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