System.Timers.Timer.Tick does not exist

  • Thread starter Thread starter Teis Draiby
  • Start date Start date
T

Teis Draiby

In a Codeproject tutorial,
http://codeproject.com/cs/miscctrl/first_control.asp?df=100&forumid=1690&select=785273
System.Timers.Timer.Tick is used, but apparently no such 'property'(?)
exists. What is the correct coding?


// Code --------------------------------

private System.Timers.Timer rotateTimer = null;

public void StartRotation(bool state)
{
rotateTimer = new System.Timers.Timer();
rotateTimer.Tick += new EventHandler(OnTimedEvent);
rotateTimer.Interval= 500;
rotateTimer.Enabled = true;
}

// -------------------------------------


thank you very much!
, Teis
 
Teis Draiby said:
In a Codeproject tutorial,
http://codeproject.com/cs/miscctrl/first_control.asp?df=100&forumid=1690&select=785273
System.Timers.Timer.Tick is used, but apparently no such 'property'(?)
exists. What is the correct coding?

Well, it's not a property, it's an event. However, it's an event on
System.Windows.Forms.Timer, not System.Timers.Timer.

Looks like that's a bug in the web page - I can't be bothered to sign
up, so I don't know whether the same bug is also in the downloadable
sources.
 
Jon Skeet said:
Well, it's not a property, it's an event. However, it's an event on
System.Windows.Forms.Timer, not System.Timers.Timer.

Looks like that's a bug in the web page - I can't be bothered to sign
up, so I don't know whether the same bug is also in the downloadable
sources.

Build Succeeded
You saved my tutorial. The code is wrong the downloadable file as well.
Maybe it is .NET beta style?

Thank you for your valuable help
,Teis
 
It looks like it was submitted during the beta, yes. Maybe you should
contact the author to get it corrected?

The correction is now posted in the discussion part (there was no email
available).

thanks, Teis
 
Back
Top