计时器控件
在窗体上同时显示一只时钟和一只10分钟的倒计时计时时钟。界面如下:
。代码如下:
Private Sub Form_Load()
Label1.Caption = "现在时刻"
Label3.Caption = "您还剩下的时间"
Label5.Caption = "对不起,时间到"
Label5.Visible = False
Label2.Caption = Time
Minute = totaltime \ 60
Second = totaltime Mod 60
Label4 = Minute & ":" & Second
reminder = totaltime
Timer1.Enabled = True
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Time
reminder = reminder - 1
Minute = reminder \ 60
Second = reminder Mod 60
If Len(Second) = 1 Then
Label4 = Minute & ":" & "0" & Second
Else
Label4 = Minute & ":" & Second
End If
If reminder = 0 Then
Label3.Visible = False
Label4.Visible = False
Label5.Visible = True
Timer1.Enabled = False
End If
End Sub
但我却运行不了,不知那里出错。请高手们指点一下!!