如何在VB.NET中每隔x秒创建一次事件回调?
答案 0 :(得分:2)
如何让它每10秒钟向我的计数器添加一个?
Public Class Form1
Private Counter As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label1.Text = Counter.ToString
Me.Timer1.Interval = TimeSpan.FromSeconds(10).TotalMilliseconds
Me.Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Counter = Counter + 1
Label1.Text = Counter.ToString
End Sub
End Class