书上有个例子:秒表计时程序
开始时间:15:03:01
结束时间:15:04:12
经过时间:00:01:11 <---label6书上是这样表示这个经过时间的。感觉这样很麻烦,还有很好的方法吗?Private Sub Timer1_Timer()
......
Dim iHour As Integer, iMinute As Integer, iSecond As Integer
Dim vTime As Variant
iHour = Hour(CDate(Label5.Caption)) - Hour(CDate(Label4.Caption))
iMinute = Minute(CDate(Label5.Caption)) - Minute(CDate(Label4.Caption))
iSecond = Second(CDate(Label5.Caption)) - Second(CDate(Label4.Caption))
vTime = TimeSerial(iHour, iMinute, iSecond)
Label6.Caption = Format(vTime, "hh:mm:ss")......
End Sub
开始时间:15:03:01
结束时间:15:04:12
经过时间:00:01:11 <---label6书上是这样表示这个经过时间的。感觉这样很麻烦,还有很好的方法吗?Private Sub Timer1_Timer()
......
Dim iHour As Integer, iMinute As Integer, iSecond As Integer
Dim vTime As Variant
iHour = Hour(CDate(Label5.Caption)) - Hour(CDate(Label4.Caption))
iMinute = Minute(CDate(Label5.Caption)) - Minute(CDate(Label4.Caption))
iSecond = Second(CDate(Label5.Caption)) - Second(CDate(Label4.Caption))
vTime = TimeSerial(iHour, iMinute, iSecond)
Label6.Caption = Format(vTime, "hh:mm:ss")......
End Sub
解决方案 »
- 请教,我这SQL语句为什么错了啊?
- 如何在通过VBA取得一个EXCEL的全部SHEET的页数合计?
- winsock控件是VB自带的吗,我怎么找不到?
- HELP!!!!判断当前应用程序目录下是否有一个名字为Client.int的文件(该文件属性为隐藏),如果没有的话建一个这样的文件,并且把属性设置为隐
- 请问怎么向一个ACCESS表里面增加字段?
- 一个难题
- 想和上海程序员交个朋友!!!
- 注册表难题,令人费解。
- 有什么办法可以让ListView的其他列显示图像?
- 请教高手,答对后分数可加至50分以上
- 救命啊!WebBrowser 控件 不能顯示office 2007 word,excel!
- VB:EXCEL图片问题
label6=format(cdate(label5)-cdate(label4),"hh:mm:ss")
我都试了一下
label6=format(cdate(label5)-cdate(label4),"hh:mm:ss") 和下面的
label6.caption=format(cdate(label5.caption)-cdate(label4.caption),"hh:mm:ss")
都是可以的,但下面的更规范些。