[求助]vb中的InputBox问题急用!谢谢!
我在程序中使用了“InputBox”,我想限制调用的次数,比如三次,代码怎么写?谢谢![此贴子已经被作者于2006-2-10 14:52:38编辑过]
[此贴子已经被作者于2006-2-10 14:52:38编辑过]
Option Explicit
Private Sub InputNum_Click()
Dim InputText As String
Static Sum As Integer
If Sum < 3 Then
Sum = Sum + 1
InputText = InputBox("请输入要显示的内容," & vbCrLf & "只能输入3次")
Print InputText;
End If
End Sub
Option Explicit
Private Sub InputNum_Click()
Dim InputText As String, i As Integer
For i = 1 To 3
InputText = InputBox("请输入要显示的内容," & vbCrLf & "只能输入3次")
Print InputText;
'如果要退出,写 Exit For 就可以了
Next
End Sub
[此贴子已经被作者于2006-2-10 16:49:49编辑过]