VB程序求大神帮做。自定义的年月日时分秒的倒计时,用text输入自定义时间减去系统时间再在text
答案:2 悬赏:10 手机版
解决时间 2021-02-19 14:25
- 提问者网友:不要迷恋哥
- 2021-02-19 10:15
VB程序求大神帮做。自定义的年月日时分秒的倒计时,用text输入自定义时间减去系统时间再在text中显示倒计时。简单就好。100财富值,好再加100。不要问我在说什么。要原程序,不要exe格式的。
最佳答案
- 五星知识达人网友:一袍清酒付
- 2021-02-19 11:49
Dim Dd As String
Dim D As Integer, S As Integer, M As Integer, H As Integer
Dim Da As String
Private Sub Command1_Click()
Dd = Format(Text1.Text, "yyyy/mm/dd hh:mm:ss")
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = False
Text1.Text = "请在此处按照2015 / 01 / 01 0:00:00的格式输入自定义的日期和时间"
End Sub
Private Sub Text1_GotFocus()
SendKeys "{home}+{end}"
End Sub
Private Sub Timer1_Timer()
Cls
If Dd > Format(Now(), "yyyy/mm/dd hh:mm:ss") Then
D = DateDiff("d", Date, Dd)
S = Right(Dd, 2) - Right(Time(), 2)
M = Mid(Right(Dd, 8), 4, 2) - Mid(Format(Time(), "hh:mm:ss"), 4, 2)
If S < 0 Then
S = S + 60
M = M - 1
End If
H = Left(Right(Dd, 8), 2) - Left(Format(Time(), "hh:mm:ss"), 2)
If M < 0 Then
M = M + 60
H = H - 1
End If
If H < 0 Then
D = D - 1
H = H + 24
End If
Da = D & "天" & H & "小时" & M & "分" & S & "秒"
Text1.Text = "距离" & Dd & "还有:" & Da
End If
End Sub
Dim D As Integer, S As Integer, M As Integer, H As Integer
Dim Da As String
Private Sub Command1_Click()
Dd = Format(Text1.Text, "yyyy/mm/dd hh:mm:ss")
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = False
Text1.Text = "请在此处按照2015 / 01 / 01 0:00:00的格式输入自定义的日期和时间"
End Sub
Private Sub Text1_GotFocus()
SendKeys "{home}+{end}"
End Sub
Private Sub Timer1_Timer()
Cls
If Dd > Format(Now(), "yyyy/mm/dd hh:mm:ss") Then
D = DateDiff("d", Date, Dd)
S = Right(Dd, 2) - Right(Time(), 2)
M = Mid(Right(Dd, 8), 4, 2) - Mid(Format(Time(), "hh:mm:ss"), 4, 2)
If S < 0 Then
S = S + 60
M = M - 1
End If
H = Left(Right(Dd, 8), 2) - Left(Format(Time(), "hh:mm:ss"), 2)
If M < 0 Then
M = M + 60
H = H - 1
End If
If H < 0 Then
D = D - 1
H = H + 24
End If
Da = D & "天" & H & "小时" & M & "分" & S & "秒"
Text1.Text = "距离" & Dd & "还有:" & Da
End If
End Sub
全部回答
- 1楼网友:枭雄戏美人
- 2021-02-19 12:48
dim txtime as integer, i as integer
private sub command1_click()
i = 0
a = format$(text1.text, "h:mm:ss")
txtime = second(a) + minute(a) * 60 + hour(a) * 3600
print txtime
timer1.enabled = true
timer1.interval = 100
end sub
private sub form_load()
text1 = "00:01:00"
timer1.enabled = false
end sub
private sub timer1_timer()
i = i + 1
form1.caption = i
if i = txtime then
msgbox "时间到"
timer1.enabled = false
end if
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯