用asp,net 做网站,我在母板界面添加了一个Timer控件,让它显示当前时间,然后在子页面用cookies获取当前
用asp,net做网站,我在母板界面添加了一个Timer控件,让它显示当前时间,然后在子页面用cookies获取当前登录的用户信息,但是我发现一添加cookies,在执行...
用asp,net 做网站,我在母板界面添加了一个Timer控件,让它显示当前时间,然后在子页面用cookies获取当前登录的用户信息,但是我发现一添加cookies,在执行子网页的时候母版上的当前时间就显示不出来了,是怎么回事儿,求大神帮忙看看。。。。我是菜鸟,这些都是自己看书学的。。。。
我一把子页面上的获取登录界面的cookies值的代码去掉,就立马可以显示当前时间了。。。。 展开
我一把子页面上的获取登录界面的cookies值的代码去掉,就立马可以显示当前时间了。。。。 展开
1个回答
推荐于2016-11-07
展开全部
Use the Timer control for longer than 1 minute
As you know, the Timer control provides a great way to schedule events in a Visual Basic project. When you enable the control, it fires off its Timer event every n milliseconds, as determined by the TimeInterval property. However, the TimeInterval property only accepts numbers up to 65,535, or just over one minute. As a result, you may have wondered how to use this control for periods longer than that. To do so, use a form, or project level, variable to keep track of how many times the Timer event fires. Then, in the Timer event, re-enable the control if enough time hasn注释:t passed. For example, consider the code below that we attached to a standard form.
Option Explicit
Dim iElapsedMin As Integer
Const cMax_Min As Integer = 2
Private Sub Form_Load()
Timer1.Enabled = True
iElapsedMin = 1
End Sub
Private Sub Timer1_Timer()
lblText.Visible = (iElapsedMin = cMax_Min)
Timer1.Enabled = (iElapsedMin < cMax_Min)
iElapsedMin = iElapsedMin + 1
End Sub
As you know, the Timer control provides a great way to schedule events in a Visual Basic project. When you enable the control, it fires off its Timer event every n milliseconds, as determined by the TimeInterval property. However, the TimeInterval property only accepts numbers up to 65,535, or just over one minute. As a result, you may have wondered how to use this control for periods longer than that. To do so, use a form, or project level, variable to keep track of how many times the Timer event fires. Then, in the Timer event, re-enable the control if enough time hasn注释:t passed. For example, consider the code below that we attached to a standard form.
Option Explicit
Dim iElapsedMin As Integer
Const cMax_Min As Integer = 2
Private Sub Form_Load()
Timer1.Enabled = True
iElapsedMin = 1
End Sub
Private Sub Timer1_Timer()
lblText.Visible = (iElapsedMin = cMax_Min)
Timer1.Enabled = (iElapsedMin < cMax_Min)
iElapsedMin = iElapsedMin + 1
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询