我创建具有计时器(作为提醒)动态形式作为通知或警报的形式。 i各自表单上分配一个名称。
所以每当它被更新..我想关闭或某些表格上禁用计时器,以便它永远不会显示(如警报)。
在每个控制找到计时器不工作,我不能禁用它。
For Each f As Form In My.Application.OpenForms
If (f.Name = Label10.Text) Or (f.Name = "notification" & Label9.Text) Then
Dim timer = Me.components.Components.OfType(Of IComponent)().Where(Function(p) p.[GetType]().FullName = "System.Windows.Forms.Timer").ToList()
For Each cmd In timer
If Not cmd Is Nothing Then
Dim tmp As Timer = DirectCast(cmd, Timer)
tmp.Enabled = False
tmp.Stop()
End If
Next
End If
Next
我将如何改变(Me.Components.Components)至f这是我的形式(f.Components.Components),请帮助我。