V
vinay
Hi,
I need to use a Timer at run time. I have created a Timer
class which has method 'CreateTimer'.
I am able to create a timer and run the associated event
(code snippet follows), but I am unable to:
1. Stop this timer.
2. Give it a specific Name (sTimer), so that I can
control its interval dynamically.
Can you Please point out what I am missing in my logic ?
Public Function CreateTimer(ByVal sTimer As string)
Dim TB As Timer
Try
TB = New Timer
TB.Enabled = True
TB.Interval = 3000 '3 seconds delay
TB.Start()
AddHandler TB.Tick, AddressOf TimerEvents01
....
End Function
Private Sub TimerEvents01(ByVal sender As Object, ByVal e
As EventArgs)
Msgbox "Testing" & Now
End Sub
Regards
Vinay
I need to use a Timer at run time. I have created a Timer
class which has method 'CreateTimer'.
I am able to create a timer and run the associated event
(code snippet follows), but I am unable to:
1. Stop this timer.
2. Give it a specific Name (sTimer), so that I can
control its interval dynamically.
Can you Please point out what I am missing in my logic ?
Public Function CreateTimer(ByVal sTimer As string)
Dim TB As Timer
Try
TB = New Timer
TB.Enabled = True
TB.Interval = 3000 '3 seconds delay
TB.Start()
AddHandler TB.Tick, AddressOf TimerEvents01
....
End Function
Private Sub TimerEvents01(ByVal sender As Object, ByVal e
As EventArgs)
Msgbox "Testing" & Now
End Sub
Regards
Vinay