Example of ElapsedTime Event Handler in .NET Jscript

407 views Asked by At

Does anyone have an example of this, I've been trying for days and I can't figure it out.

Help...

Here is one of the things I've tried:

var aTimer = new System.Timers.Timer(10000);
aTimer.add_Elapsed(handler);
}

public function handler(sender: Object, e : ElapsedEventArgs){ }
1

There are 1 answers

0
Simon MᶜKenzie On

Your aTimer object appears to be a local variable within a function, which means that it may get garbage collected. Try moving it to a field in your class.

Also, after you set the Elapsed property, you need to start the timer:

aTimer.Start();