VB代码请教高手
通过一个按钮,让TEXT1里随机生成剩余时间(必须大于120分)(时间格式时:分:秒)然后开始倒计时,时间一道就弹出一个窗口提示"ydvyyywscg"
参考答案:晕,这都看不懂啊,a bc分别是 时,分,秒,你+我QQ吧 ***********
'添加一个命令按纽和一个计时器
Public a, b, c As Integer
Private Sub Command1_Click()
a = Int(Rnd * 10 + 2)
b = Int(Rnd * 59)
c = Int(Rnd * 59)
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Command1.Caption = "随即剩余时间"
Timer1.Interval = 1000
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Cls
c = c - 1
Print "剩余时间是" & a & ":" & b & ":" & c
If c = 0 And b <> 0 Then
c = 59
b = b - 1
End If
If b = 0 And a > 1 Then
a = a - 1
b = 59
End If
If c = 0 And a = 0 And b = 0 Then
Timer1.Enabled = False
MsgBox "时间到"
End If
End Sub