| Trapping for a timer firing |
| by Steven Sartain |
Published
03/19/2002
|
.NET Framework
|
This article has not yet been rated.
|
|
|
Steven Sartain
 Steven Sartain is a consultant currently designing and leading a VB.NET project using n-tier architecture and WebServices for Accuride International Ltd.
During his 8 year career as a developer and development lead, Steve has designed and implemented a diverse number of mission critical software solutions using VB, VBA, MS Access, C/C++, ASP, Delphi, DCOM & MTS, SQL Server, Oracle, SQL Anywhere and others. See his Resume for details.
He is also a Director of Iridium Software - a UK based bespoke software development house.
Steve is always open to take over a challenging programming opportunity. If you experience a need for a professional consultant who has all the necessary skills to take a proposition from first client meeting through to profitably and elegantly completed projects; I'm sure Steve could assist. See his Resume and Professional Statement for details.
View all articles by Steven Sartain...
Trapping for a timer firing
How to trap for a timer firing
Start a new project then add a module. Add the following code to the module:
'Author: Steven Sartain
'Last Revision: 28th August 2001
'Revision Notes: None
'Supported environments:
' Yes No Untested
' VB4 X
' VB5 X
' VB6 X
' VB.NET(beta2) X
Imports System.Threading
Namespace vbCity
Public Module modFunctions
Private udtTimer as Timer
Public Sub StartTimer(pintNumberOfSecondsToFire As Int32)
'convert the param to mili
Dim pintMili As Int32 = pintNumberOfSecondsToFire * _
1000
udtTimer = New Timer(New TimerCallback( _
AddressOf TimerFire), Nothing, pintMili, pintMili)
End Sub
Private Sub TimerFire(udtObject As Object)
Console.WriteLine("Timer Fired....")
'reset the timer
udtTimer.Dispose
udtTimer = Nothing
End Sub
End Module
End Namespace
|
|
|
How would you rate the quality of this article?
Tell us why you rated this way (optional):
|
|
Article Rating
The average rating is:
No-one else has rated this article yet.
|
|