vb高手帮我看看怎么让inputbox只能输入数字
Fori=1To10a(i)=InputBox("请输入整数")IfNotIsNumeric(a(i))ThenMsgBox"输入数据无效,请重新输入,请输入第"&n&"...
For i = 1 To 10
a(i) = InputBox("请输入整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & n & "个数"
End If
a(i)是定义的数组,
Dim a(1 To 10) As Integer
Dim i, s As Integer
Private Sub Command1_Click()
For i = 1 To 10
a(i) = InputBox("请输入整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & n & "个数"
End If
Next i 展开
a(i) = InputBox("请输入整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & n & "个数"
End If
a(i)是定义的数组,
Dim a(1 To 10) As Integer
Dim i, s As Integer
Private Sub Command1_Click()
For i = 1 To 10
a(i) = InputBox("请输入整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & n & "个数"
End If
Next i 展开
展开全部
Option Base 1
Dim a(10) As Integer
Private Sub Command1_Click()
Dim b As String
For i = 1 To 10
Do While Not (IsNumeric(b))
b = InputBox("请输入第" & i & "个整数")
If Not IsNumeric(b) Then MsgBox "输入数据无效,请重新输入,请输入第" & i & "个数"
Loop
a(i) = b
b = ""
Next i
End Sub
Dim a(10) As Integer
Private Sub Command1_Click()
Dim b As String
For i = 1 To 10
Do While Not (IsNumeric(b))
b = InputBox("请输入第" & i & "个整数")
If Not IsNumeric(b) Then MsgBox "输入数据无效,请重新输入,请输入第" & i & "个数"
Loop
a(i) = b
b = ""
Next i
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim a(1 To 10) As String
Dim i, s As Integer
For i = 1 To 10
a(i) = InputBox("请输入第" & i & "个整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & i & "个数"
i = i - 1
End If
Next i
Dim i, s As Integer
For i = 1 To 10
a(i) = InputBox("请输入第" & i & "个整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & i & "个数"
i = i - 1
End If
Next i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
http://zhidao.baidu.com/question/24074027.html
很详细。。。。以后自己找找看再问
很详细。。。。以后自己找找看再问
追问
Dim a(1 To 10) As Integer
Dim i, s As Integer
Private Sub Command1_Click()
For i = 1 To 10
a(i) = InputBox("请输入整数")
If Not IsNumeric(a(i)) Then
MsgBox "输入数据无效,请重新输入,请输入第" & n & "个数"
End If
是这样的,那个a(i)是定义的数组,和那个单纯的mm不一样。
我是新手,不太懂,谢谢你了。能加qq吗?245617122
追答
楼下那位写的应该符合你要求了吧?
a(i)=inputbox("请输入数字","这是标题","0")
do until isnumeric(a(i)) = true or len(a(i))=0
msgbox "请输入数字,谢谢合作",16,"警告"
a(i)=inputbox("请输入数字","这是标题")
loop
msgbox "您输入的数字是"&a(i),64,"谢谢合作" !
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询