I have an user control which include timer. When timer event run, it will call some threads.
User Control
class MyControl { public Timer iTime { get; set; } Timer tmr; public MyControl { tmr = new Timer(); } // Some Properties } } Main Form
class MyForm { Thread thd; MyControl cls = new MyClass(); cls.iTime.Tick += new EventHandler(iTime_Tick); void iTime_Tick(object sender, EventArgs e) { thd = new Thread(delegate() { doWork(1); }); thd.Start(); thd = new Thread(delegate() { doOtherJob(); }); thd.Start(); } delegate void notif(int Param1); void Job(int Param1) { if (this.InvokeRequired) { notif handler = new notif(notifParam); this.Invoke(handler, new object[] { Param1 }); } else { // Other Process } } private void Logout() { cls.iTime.Stop(); cls.iTime.Enabled = false; cls.iTime.Tick -= new EventHandler(iTime_Tick); thd.abort(); thd.join(); } } How to terminate thread in timer ? When I unsubscribe timer event even close form, the threads still run.