Hello friends,
I have read numerous threads in this site as well as Google but still cannot seem to get a simple timer to fuction properly. All I want to do is create a timer that fires every 15 seconds and execute the code in my Elapsed Time Event. My simplified example is as follow:
'////////////////////////////////////////////
Imports System
Imports System.Timers
Public Class TimerTest
Public Shared Qtimer As New System.Timers.Timer
Public Shared Sub main()
Qtimer.Interval = 15000
Qtimer.Enabled = True
End Sub
Private Shared Sub Qtimer_Tick(ByVal sender As Object, ByVal e As ElapsedEventArgs) _
Handles Qtimer.Elapsed
MessageBox.Show("Event is FIRED!!!")
End Sub
End Class
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
For some reason, my code never reaches the sub Qtimer_Tick. Please shed some light into why this is not working for me at all. I am not using any form. This will be created as a service. I copied this sample code almost verbatim from one of the thread on this site.
Thanks ahead for any comments!!
I have read numerous threads in this site as well as Google but still cannot seem to get a simple timer to fuction properly. All I want to do is create a timer that fires every 15 seconds and execute the code in my Elapsed Time Event. My simplified example is as follow:
'////////////////////////////////////////////
Imports System
Imports System.Timers
Public Class TimerTest
Public Shared Qtimer As New System.Timers.Timer
Public Shared Sub main()
Qtimer.Interval = 15000
Qtimer.Enabled = True
End Sub
Private Shared Sub Qtimer_Tick(ByVal sender As Object, ByVal e As ElapsedEventArgs) _
Handles Qtimer.Elapsed
MessageBox.Show("Event is FIRED!!!")
End Sub
End Class
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
For some reason, my code never reaches the sub Qtimer_Tick. Please shed some light into why this is not working for me at all. I am not using any form. This will be created as a service. I copied this sample code almost verbatim from one of the thread on this site.
Thanks ahead for any comments!!