jaxrpc
asked on
Add elaspedEvent to System.timer
Hi, i have created a Dim myTimer as new System.timer(1000) .
Now i have a function which i wants the timer to call every 1sec. How do i write the code for tell the timer which function to call when there's an elapsedEvent.
Assumming
Dim myTimer as New System.timer(1000) ' my timer created at run-time
Public Sub mySubProc()
'Do some stuffs here every 1 sec
End Sub
thanks
Now i have a function which i wants the timer to call every 1sec. How do i write the code for tell the timer which function to call when there's an elapsedEvent.
Assumming
Dim myTimer as New System.timer(1000) ' my timer created at run-time
Public Sub mySubProc()
'Do some stuffs here every 1 sec
End Sub
thanks
ASKER
hmm what if i want to do it programmatically, like adding delegate event programmatically.
like initialise a new system.timer()
and when it starts it will call an event.
And i might need to initalise an array of timers.
like initialise a new system.timer()
and when it starts it will call an event.
And i might need to initalise an array of timers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Sub button1_Click(sender As Object, e As System.EventArgs) Handles button1.Click
myTimer.Enabled = True
End Sub
Then you have to catch the Timer tick event:
Private Sub myTimer_Tick(sender As Object, e As System.EventArgs) Handles myTimer.Tick
mySubProc()
End Sub