【发布时间】:2014-02-09 08:49:56
【问题描述】:
- 我必须使用处理程序创建多个计时器“n”次。
- 这将存储在我的 DataGrid 中的一行。
- 每一行都有一个单独工作的计时器。
我的想法是这样的:
Private Sub CreateTimer()
Dim tmr As New Timer
tmr.Interval = 1000 '1 Second
tmr.Enabled = True
AddHandler tmr.Tick, AddressOf GlobalTimerTick
End Sub
'A timer tick handler that would work for each timer I add with the sub above
'All timers I created should work seperately
Private Sub GlobalTimerTick(TheTimer as Timer, ByVal sender As Object, ByVal e As EventArgs)
mynumber = mynumber + 1
With DataGridView1
.Rows(n).Cells(4).Value = mynumber " saniye"
End With
End Sub
那么我该如何实现呢?
【问题讨论】:
-
您可以使用
Tag属性来了解哪个计时器与哪个行相关联。 msdn.microsoft.com/en-us/library/…
标签: vb.net datagridview timer handler