Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer event

Status
Not open for further replies.

LJS1

Programmer
Apr 29, 2002
39
0
0
US
I am attempting to write some code (in a VB web application) using a timer that executes every 5 seconds. So far the only code I've found that does this task is similar to:

<%@ import Namespace=&quot;System.Timers&quot; %>

Public Sub ProcessTimerEvent(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
Response.Write(&quot;Timer Fired!&quot;)
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

' call function every 5 seconds to do something
TimerRec = New System.Timers.Timer()
AddHandler TimerRec.Elapsed, AddressOf ProcessTimerEvent
TimerRec.Interval = 5000
TimerRec.Enabled = True
End Sub

But it doesn't work! So essentially I would like the words &quot;Timer Fired!&quot; should be displayed every 5 seconds, but I don't see that on the screen. Can anyone help me fix this bit of code so the timer actually fires and does something useful?
 
LJ - good question. I played around with the code for quite some time, doing some research at several dot NET sites looking for clues.

I'm anxious to see what makes this thing tick (no pun intended). You might try using the drag and drop timer in VB Studio to see if you can get it to function (toolbox).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top