橡胶工艺品生产厂家:如何在VB中使TEXTBOX只能输入数字,并支持Ctrl+V粘贴?
来源:百度文库 编辑:高校问答 时间:2024/07/05 11:31:05
使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