C#: Catching an event from a timer in a class
Posted on 2002-04-16
There needs to be a C# forum.
I have created a class in which I need a timer. Something like this;
public class myClass
public System.Windows.Forms.Timer myTimer;
myTimer = new System.Windows.Forms.Timer();
myTimer.interval = 1000;
myTimer.enabled = true;
How do I now catch that tick event?
This timer isn't a form anywhere so I created it dynamically.. This works as it does in delphi but damn if I know how to catch that event.
A timer I dropped on my form just for testing purposes gave me an event like this;
private void myTimer_tick(object sender, System.EventArgs e)
// Do thing here
But somewhere I must attach myTimer to the myTimer_tick event.. How do I do this? (This is probably very simple.. I'm new to C#..)