Private Sub Text1_Change()
Dim Starttime As Variant
Dim Elapsed As Variant
Dim Endtime As Variant
End
Private Sub cmdStart_Click()
'显示开始时间
lblStart.Caption = Time$
Starttime = Now
'启动时钟控件
Timer1.Enabled = Ture
End Sub
Private Sub cmdStop_Click()
'记录停止时间
Endtime = Now
'关闭时钟控件
Timer1.Enabled = False
'显示经过时间
lblApaed.Caption=Format(Endtime-Starttime,"hh:mm:ss"
End Sub
Private Sub Timer1_Timer()
lblStop.Caption = Time$
End Sub
End Sub
Private Sub Text1_Change()
Dim Starttime As Variant
Dim Elapsed As Variant
Dim Endtime As Variant
End
Private Sub cmdStart_Click()
'显示开始时间
lblStart.Caption = Time$
Starttime = Now
'启动时钟控件
Timer1.Enabled = Ture ‘这句写错了,应该改成: Ture
End Sub
Private Sub cmdStop_Click()
'记录停止时间
Endtime = Now
'关闭时钟控件
Timer1.Enabled = False
'显示经过时间
lblApaed.Caption=Format(Endtime-Starttime,"hh:mm:ss"
End Sub
Private Sub Timer1_Timer()
lblStop.Caption = Time$
End Sub
'改好了,主要是End sub放错地方了,你可以运行如下代码调试
Dim Starttime As Variant
Dim Elapsed As Variant
Dim Endtime As Variant
Private Sub Text1_Change()
End
End Sub
Private Sub cmdStart_Click()
'显示开始时间
lblStart.Caption = Time$
Starttime = Now
'启动时钟控件
Timer1.Enabled = Ture
End Sub
Private Sub cmdStop_Click()
'记录停止时间
Endtime = Now
'关闭时钟控件
Timer1.Enabled = False
'显示经过时间
lblApaed.Caption = Format(Endtime - Starttime, "hh:mm:ss")
End Sub
Private Sub Timer1_Timer()
lblStop.Caption = Time$
End Sub