Web App - Programmatic Timer not firing

Howdy.

I’m trying to programmatically add a timer into the App.Open Event that calls a method. The method seems to never get called. I added breakpoints at the Dim lines in the method at the very first line. What am I doing wrong?

[code] Dim MyTimer as New Timer
MyTimer.Mode = Timer.ModeMultiple
MyTimer.Period = 5000

AddHandler MyTimer.Action, AddressOf ServerPing
MyTimer.Enabled=True[/code]

Your timer is going out of scope. Add a property to app MyTimer As Timer. Then use

MyTimer = New Timer AddHandler MyTimer.Action, AddressOf ServerPing MyTimer.Period = 5000 MyTimer.Mode = Timer.ModeMultiple

I always prefer to add the handler before invoking the timer. Setting the timer mode kicks it off.

HTH

Wayne

Wow.

Thanks for that quick help! That worked perfectly.