在VB.net中调用Timer [英] call a Timer in VB.net
本文介绍了在VB.net中调用Timer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好b $ b
如何在VB.NET中每x分钟调用一次函数?如果可能,请提供代码示例。
谢谢....
解决方案
尝试:
昏暗分钟作为 整数 = 5 ' 将5改为分钟数
Dim t As 新 System.Timers.Timer( 60000 *分钟)
AddHandler t.Elapsed, AddressOf t_Elapsed
t.Start ()' 启动计时器
< span class =code-keyword>私有 Sub t_Elapsed(sender As 对象,e As System.Timers.ElapsedEventArgs)
' 此方法将每5分钟调用一次
结束 Sub
希望这会有所帮助。
只需 Google搜索 [ ^ ]你可能会发现很多关于使用定时器的教程 VB.NET
Hi
How do I call a function every x minutes in VB.NET? Please provide a code sample if possible.
Thanks....
解决方案
Hi,
Try:
Dim minutes As Integer = 5 ' change 5 into the count of minutes Dim t As New System.Timers.Timer(60000 * minutes) AddHandler t.Elapsed, AddressOf t_Elapsed t.Start() ' start the timerPrivate Sub t_Elapsed(sender As Object, e As System.Timers.ElapsedEventArgs) ' this method will be called every 5 minutes End Sub
Hope this helps.
Just Googling for[^] you may find many many tutorials on using timers with VB.NET
.
这篇关于在VB.net中调用Timer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文