I have included the System.Timers
package, but when I type:
Timer.Elapsed; //its not working, the property elapsed is just not there.
I remember it was there in VB.NET. Why doesn't this work?
It's not a property. It's an event.
So you gotta provide an event handler that will execute every time the timer ticks. Something like this:
public void CreateTimer()
{
var timer = new System.Timers.Timer(1000); // fire every 1 second
timer.Elapsed += HandleTimerElapsed;
}
public void HandleTimerElapsed(object sender, ElapsedEventArgs e)
{
// do whatever it is that you need to do on a timer
}