vb中弹出inputbox对话框后,计时器不运行,这是怎么回事呢?谢谢!
题目要求是:随机产生一个一位数与两位数算式,用户计算结果,系统计时并记分这是我的代码PrivateSubCommand1_Click()Dimy%,n%,m%,c%,fe...
题目要求是:随机产生一个一位数与两位数算式,用户计算结果,系统计时并记分
这是我的代码
Private Sub Command1_Click()
Dim y%, n%, m%, c%, fenshu%, dengshi$
y = 0: n = 0: m = 0: c = 0: fenshu = 0
Randomize
For i = 1 To 10
a = Str(Int(Rnd * 10 + 0))
b = Str(Int(Rnd * 90 + 10))
dengshi = a & "+" & b & "="
Print dengshi;
daan = Val(InputBox("请输入第" & i & "题答案"))
If daan = Val(a) + Val(b) Then
chengji = 10
n = n + 1
Print daan
Else
Print daan; "答案不正确"
daan1 = Val(InputBox("答案不正确,请在此输入"))
If daan1 = Val(a) + Val(b) Then
chengji = 5
Print dengshi; daan1
m = m + 1
Else
chengji = 0
Print dengshi; daan1
c = c + 1
End If
End If
fenshu = fenshu + chengji
Next
y = n + m
Print "总成绩:"; fenshu
Print "正确个数:"; y
Print "其中第一次做对个数:"; n
Print "第二次做对个数:"; m
Print "做错个数"; c
Command1.Caption = "再做一套"
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Timer1.Enabled = True
Command1.Enabled = True
End Sub
Private Sub Command4_Click()
Form1.Cls
End Sub
Private Sub Form_Load()
Command2.Enabled = False
Label1.Caption = 0
Command1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption + 1
If Label1.Caption = 60 Then
Timer1.Enabled = False
Label2.Caption = "时间已到"
Label1.Caption = ""
Label3.Caption = ""
Exit Sub
End If
End Sub 展开
这是我的代码
Private Sub Command1_Click()
Dim y%, n%, m%, c%, fenshu%, dengshi$
y = 0: n = 0: m = 0: c = 0: fenshu = 0
Randomize
For i = 1 To 10
a = Str(Int(Rnd * 10 + 0))
b = Str(Int(Rnd * 90 + 10))
dengshi = a & "+" & b & "="
Print dengshi;
daan = Val(InputBox("请输入第" & i & "题答案"))
If daan = Val(a) + Val(b) Then
chengji = 10
n = n + 1
Print daan
Else
Print daan; "答案不正确"
daan1 = Val(InputBox("答案不正确,请在此输入"))
If daan1 = Val(a) + Val(b) Then
chengji = 5
Print dengshi; daan1
m = m + 1
Else
chengji = 0
Print dengshi; daan1
c = c + 1
End If
End If
fenshu = fenshu + chengji
Next
y = n + m
Print "总成绩:"; fenshu
Print "正确个数:"; y
Print "其中第一次做对个数:"; n
Print "第二次做对个数:"; m
Print "做错个数"; c
Command1.Caption = "再做一套"
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Timer1.Enabled = True
Command1.Enabled = True
End Sub
Private Sub Command4_Click()
Form1.Cls
End Sub
Private Sub Form_Load()
Command2.Enabled = False
Label1.Caption = 0
Command1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption + 1
If Label1.Caption = 60 Then
Timer1.Enabled = False
Label2.Caption = "时间已到"
Label1.Caption = ""
Label3.Caption = ""
Exit Sub
End If
End Sub 展开
展开全部
正常呀,弹出后程序会停在这里等待输入。
如果不想停的话那就自己做个对话窗口就可以啦。
如果不想停的话那就自己做个对话窗口就可以啦。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
MsgBox 和 inputbox 都会让程序停在这里等待
最好就是自己做一个对话窗口.
最好就是自己做一个对话窗口.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询