以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于窗口计时器  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=103481)

--  作者:晕了快扶我
--  发布时间:2017/7/9 22:14:00
--  关于窗口计时器
 在同一个窗口,我有两段代码代码,需要不同的时间刷新,要怎么弄啊?
有一段是1秒一次
有一段是10秒一次

--  作者:有点甜
--  发布时间:2017/7/9 23:22:00
--  

 做个变量记录就好了

 

static pt1 As Date = Date.now.AddSeconds(-1)
static pt10 As Date = Date.now.AddSeconds(-1)
Dim d As Date = Date.now
Dim sp1 As TimeSpan = d - pt1
Dim sp10 As TimeSpan = d - pt10
If sp10.TotalSeconds >= 10 Then
    pt10 = d
    msgbox("10")
End If
If sp1.TotalSeconds >= 1 Then
    pt1 = d
    msgbox("1")
End If