提升消息计时器 [英] Raising message timer
本文介绍了提升消息计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在课堂上有这个子课程:
I have this sub in a class:
Private Sub TimerTick(ByVal sender As Object, ByVal e As EventArgs) Handles myTimer.Tick
If alarmTime < Date.Now Then
myTimer.Stop()
RaiseEvent TimerComplete("Your time is up")
Else
RemainingTime = alarmTime.Subtract(Date.Now)
RaiseEvent Elapsed(RemainingTime)
End If
If RemainingTime.Minutes < 1 Then
RaiseEvent OnAlert("1 minute left")
End If
End Sub
问题是当我在带有消息框的表单中引发最后一个事件OnAlertEvent时,在evey计时器勾选时会显示一个新的消息框,勾选填充屏幕。任何人都可以帮助
Problem is when I raise the last event OnAlertEvent in the form with messagebox, at evey timer tick a new messagebox is shown tick filling up screen.Can anyone help
推荐答案
Private Sub TimerTick(ByVal sender As Object, ByVal e As EventArgs) Handles myTimer.Tick
If alarmTime < Date.Now Then
myTimer.Stop()
RaiseEvent TimerComplete("Your time is up")
Else
RemainingTime = alarmTime.Subtract(Date.Now)
RaiseEvent Elapsed(RemainingTime)
End If
If RemainingTime.Minutes = 1 Then
RaiseEvent OnAlert("1 minute left")
End If
End Sub
设置定时器控件的 60000的间隔,因此它会每隔一分钟触发一次滴答事件
快乐编码!
:)
set timer control''s Interval for 60000, so it will fire tick event on every one minute
Happy Coding!
:)
这篇关于提升消息计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文