VB6 如何在text控件失去焦点之后判断是否输入的全是数字?
2013-12-11
展开全部
Private Sub Text1_LostFocus()
Dim i As Integer
Dim c As Integer
For i = 1 To Text1.Text
c = Asc(Mid(Text1.Text, i, 1))
If c < 48 Or c > 57 Then
MsgBox "含有非数字字符"
Exit For
End If
Next
End Sub
Dim i As Integer
Dim c As Integer
For i = 1 To Text1.Text
c = Asc(Mid(Text1.Text, i, 1))
If c < 48 Or c > 57 Then
MsgBox "含有非数字字符"
Exit For
End If
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询