VB高手来啊!关于时间!

来源:百度知道 编辑:UC知道 时间:2024/05/31 05:59:44
我想通过输入一个整数,这个整数也就是时间分钟!然后把这个整数转换成,
00:00:00 对应 小时:分钟:秒
在一个标签上显示出,并按正常时间倒计时!
在这个时间倒计时为0时 发生一些事件!
请高手指点!!

Option Explicit
Dim Times As Integer
Dim Timess As Integer

Private Sub Form_Load()
Times = Val(InputBox("请输入时间!", "提示", 100))
Timess = 60 * Times
End Sub
Private Sub Timer1_Timer()
Dim Hours As Integer
Dim Minutes As Integer
Dim Seconds As Integer
Timess = Timess - 1
Hours = Timess \ 3600
Minutes = (Timess Mod 3600) \ 60
Seconds = Timess Mod 60
'显示时间
Label1.Caption = Format(Hours, "00") & ":" & Format(Minutes, "00") & ":" & Format(Seconds, "00")
End Sub

Option Explicit
Dim dtEnd As Date

Private Sub Command1_Click()
Dim strTmp As String
Dim dlT As Double
Dim ltp As Long

strTmp = Text1.Text

dtEnd = DateAdd("n", CDbl(strTmp), Now())
dlT = CDbl(strTmp)
strTmp = CStr(dlT \ 60) & ":" & Format