B
Bobby
Dear all,
could someone show me how one would complete the following MSDN
example :
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class Timer1
Public Shared Sub Main()
Dim aTimer As New System.Timers.Timer()
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
' Set the Interval to 5 seconds.
aTimer.Interval = 5000
aTimer.Enabled = True
Console.WriteLine("Press 'q' to quit the sample.")
While Console.Read() <> CInt("q")
End While
End Sub
' Specify what you want to happen when the Elapsed event is
raised.
Private Shared Sub OnTimedEvent(source As Object, e As
ElapsedEventArgs)
Console.WriteLine("Hello World!")
End Sub
End Class
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
so that one could have Timers for different objects and in the
OnTimeEvent you could get the object to whom this timer belongs? Is
this possible at all?
Many Thanks.
could someone show me how one would complete the following MSDN
example :
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class Timer1
Public Shared Sub Main()
Dim aTimer As New System.Timers.Timer()
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
' Set the Interval to 5 seconds.
aTimer.Interval = 5000
aTimer.Enabled = True
Console.WriteLine("Press 'q' to quit the sample.")
While Console.Read() <> CInt("q")
End While
End Sub
' Specify what you want to happen when the Elapsed event is
raised.
Private Shared Sub OnTimedEvent(source As Object, e As
ElapsedEventArgs)
Console.WriteLine("Hello World!")
End Sub
End Class
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
so that one could have Timers for different objects and in the
OnTimeEvent you could get the object to whom this timer belongs? Is
this possible at all?
Many Thanks.