VB中关于TEXT中的数字输出入
PrivateSubText1_Change()DimIAsIntegersum=Val(Text1.Text)ForI=1ToLen(Text1.Text)IfIsNu...
Private Sub Text1_Change()
Dim I As Integer
sum = Val(Text1.Text)
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
Label6.Caption = sum
Else
Label6.Caption = "请输入正确数字"
End If
End Sub
如果想只能输100以内的数,别的数输入无效应怎么改上面这个程序 展开
Dim I As Integer
sum = Val(Text1.Text)
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
Label6.Caption = sum
Else
Label6.Caption = "请输入正确数字"
End If
End Sub
如果想只能输100以内的数,别的数输入无效应怎么改上面这个程序 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询