The God txt:vb小问题急需请教

来源:百度文库 编辑:中科新闻网 时间:2024/05/03 01:49:03
Private Sub Form_Load()

Dim startime, endtime, passtime

Label1.Caption = "开始时间"
Label2.Caption = "停止时间"
Label3.Caption = "经过时间"
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Command1.Caption = "开始"
Command2.Caption = "停止"
Command2.Enabled = False
End Sub

Private Sub Command1_Click()
startime = Now
Label4.Caption = Format(startime, "hh:mm:ss")

Command2.Enabled = True
Command1.Enabled = False

End Sub

Private Sub Command2_Click()
endtime = Now
Label5.Caption = Format(endtime, "hh:mm:ss")
passtime = startime - endtime

Label6.Caption = Format(pastime, "hh:mm:ss")
Command1.Enabled = True
Command2.Enabled = False

End Sub

怎么就是得不出startime-endtime=passtime

时间格式好像不可以直接加减吧。。。

passtime = endtime - startime

明显反了。