AddHandler

I have defined a timer in the App class of a Web application called “LogTimer”

I wish the method MyMethod to pretty frequently

[code] LogTimer = New Timer
LogTimer.Period = 1000
LogTimer.Mode = Timer.ModeMultiple

AddHandler LogTimer.Action, AddressOf MyMethod[/code]

However I get an error: Type mismatch error. Expected delegate Delegate(Timer), but got Delegate ()

What Am I missing?

MyMethod should be declared this way:

Sub MyMethod (sender As Timer)

When using AddHandler, the first parameter is always the object that initiated the method.

Did you supply the first parameter as a reference to the timer?

For example:

Sub TimerAction(sender As Xojo.Core.Timer)

Thanks Kem/Paul!