用VB语言编写亚运会倒计时程序?
- 提问者网友:太高姿态
- 2021-07-24 16:26
- 五星知识达人网友:低血压的长颈鹿
- 2021-07-24 17:12
准备一个timer控件
两个事件
一个
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
另一个
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim scond As String
Dim minuint As String
Dim hours As String
Dim day As String
Dim between As String
between = DateDiff("s", Now, "2010-11-12 20:00:00").ToString() '获取距开幕的时间以秒为单位
day = between \ (60 * 60 * 24) '以秒转为天
hours = (between - day * (60 * 60 * 24)) \ (60 * 60) '扣除天数,转为时
minuint = (between - day * (60 * 60 * 24) - hours * (60 * 60)) \ 60 '获取分
scond = (between - day * (60 * 60 * 24) - hours * (60 * 60) - minuint * 60) '获取秒
Label1.Text = "距广运会开幕还有" & day & "天" & hours & "时" & minuint & "分" & scond & "秒"
End Sub
- 1楼网友:三千妖杀
- 2021-07-24 18:38
- 2楼网友:鸽屿
- 2021-07-24 18:15
Private Sub Form_Load() Timer1.Enabled = True Timer1.Interval = 1000 End Sub
Private Sub Timer1_Timer() Label1.Caption = "距离广州亚运会还有 " & #11/12/2010# - Date & " 天" End Sub