Private Sub Command1_Click()
' 我的原来思想
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'If Text1(0).Text = "" And Text1(1).Text = "" And Text1(2).Text = "" And Text1(3).Text = "" And Text1(4).Text = "" Then
'MsgBox ("请输入正确详细的日期和时间")
'Else
Label3.Caption = Now
'Label9(0).Caption = Str(Str(Text1(0).Text) - Str(Year(Now))) * 365 + Str(Str(Text1(1).Text) - Str(Month(Now))) + Str(Str(Text1(2).Text) - Str(Day(Now)))
'Label9(1).Caption = Str(Str(Str(Text1(3).Text) - Str(Hour(Now))) + Str(Str(Text1(4).Text) - Str(Second(Now))))
'End If
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' 定义各类的取值
'****************************************************************************
'年份的值------
nianfen = Text1(0).Text
If nianfen > 1900 And nianfen < 2500 Then
Else
Text1(0).Text = ""
MsgBox ("年份请输入1900到2500之间的整数")
End If
'月份的值------
yefen = Text1(1).Text
If yefen > 0 And yefen < 13 Then
Else
Text1(1).Text = ""
MsgBox ("月份请输入1到12之间的整数")
End If
'日期的值------
yuchi = Text1(2).Text
If yuchi > 0 And yuchi < 32 Then
Else
Text1(2).Text = ""
MsgBox ("日期请输入1到31之间的整数")
End If
'小时的值------
xiaoshi = Text1(3).Text
If xiaoshi > -1 And xiaoshi < 24 Then
Else
Text1(3).Text = ""
MsgBox ("小时请输入0到23之间的整数")
End If
'分钟的值------
fenzhong = Text1(4).Text
If fenzhong > -1 And fenzhong < 61 Then
Else
Text1(4).Text = ""
MsgBox ("分钟请输入0到60之间的整数")
End If
'秒钟的值------
miaozhong = Text1(5).Text
If miaozhong > -1 And miaozhong < 61 Then
Else
Text1(5).Text = ""
MsgBox ("秒钟请输入0到60之间的整数")
End If
'****************************************************************************
' 定义取值完成
'----------------------------------------------------------------------------
' 主要设计函数
'<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Dim TimeSet As Date
TimeSet = Text1(0).Text + "-" + Text1(1).Text + "-" + Text1(2).Text + " " + Text1(3).Text + ":" + Text1(4).Text + ":" + Text1(5)
Label9(0) = DateDiff("d", Now, TimeSet)
Label9(1) = Str(DateDiff("h", Now, TimeSet) - Label9(0).Caption * 24)
'Label9(1) = Str(Str(Text1(3).Text) - Str(Hour(Now)))
'Label9(2) = Str(DateDiff("m", Now, TimeSet) - Label9(1).Caption * 60)
'Label9(3) = Str(DateDiff("s", Now, TimeSet) - Label9(2).Caption * 24)
If Label9(1) < 0 Then
Label9(0) = Str(Str(DateDiff("d", Now, TimeSet)) - 1)
Label9(1) = Str(DateDiff("h", Now, TimeSet) - Label9(0).Caption * 24)
'Label9(2) = Str(DateDiff("m", Now, TimeSet) - Label9(1).Caption * 60)
'Label9(3) = Str(DateDiff("s", Now, TimeSet) - Label9(2).Caption * 24)
Else
Label9(0) = DateDiff("d", Now, TimeSet)
Label9(1) = Str(DateDiff("h", Now, TimeSet) - Label9(0).Caption * 24)
'Label9(2) = Str(DateDiff("m", Now, TimeSet) - Label9(1).Caption * 60)
'Label9(3) = Str(DateDiff("s", Now, TimeSet) - Label9(2).Caption * 24)
End If
' ---分钟秒钟的定义---
'Dim a, b, c, d As Timer
'a = Str(Text1(4).Text)
'b = Str(Minute(Now))
'c = Str(Text1(5).Text)
'd = Str(Second(Now))
'If a > b Then
'Label9(2).Caption = Str(Str(Text1(4).Text) - Str(Minute(Now)))
'ElseIf a > b Then
'Label9(2).Caption = Str(Str(60 - Str(Minute(Now))) + Str(60 - Str(Text1(4).Text)))
'End If
'If c > d Then
'Label9(3).Caption = Str(Str(Text1(5).Text) - Str(Second(Now)))
'ElseIf c > d Then
'Label9(3).Caption = Str(Str(60 - Str(Second(Now))) + Str(60 - Str(Text1(5).Text)))
'End If
' ----定义完成----
'<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
End Sub