永发信息网

用VB语言编写亚运会倒计时程序?

答案:3  悬赏:0  手机版
解决时间 2021-07-25 13:47
  • 提问者网友:太高姿态
  • 2021-07-24 16:26
用VB语言编写亚运会倒计时程序?
最佳答案
  • 五星知识达人网友:低血压的长颈鹿
  • 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
我不知道亚运会的时间呢,使用timer控件,每一秒让亚运会的时间减去系统日期时间
  • 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

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯