Click here to Skip to main content
15,902,198 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to find relation between user , process created by him and his session Pin
Dario Solera1-Jul-05 23:48
Dario Solera1-Jul-05 23:48 
Generalpopulating datagrid with array of objects Pin
deep71-Jul-05 23:34
deep71-Jul-05 23:34 
GeneralChanging Regional Language of a TextBox Pin
Ali Beirami1-Jul-05 23:01
Ali Beirami1-Jul-05 23:01 
GeneralSend a click to an application Pin
Dario Solera1-Jul-05 21:15
Dario Solera1-Jul-05 21:15 
GeneralAdding Help in a software Pin
asmyan1-Jul-05 21:06
asmyan1-Jul-05 21:06 
GeneralRe: Adding Help in a software Pin
Ashok Dhamija1-Jul-05 21:10
Ashok Dhamija1-Jul-05 21:10 
GeneralRe: Adding Help in a software Pin
Dario Solera1-Jul-05 23:55
Dario Solera1-Jul-05 23:55 
GeneralThreads and System.Timers.Timer - Problems Pin
stan281-Jul-05 20:41
stan281-Jul-05 20:41 
Have you guys ever realised that when you have a component class that has a timer, and when your Thread calling the method finishes off, the Timer events still gets fired.. Why is this so.. Look at the following code as an illustration.


public class WithTimer : System.ComponentModel.Component
{
 private System.Timers.Timer timer1;
 public WithTimer(){}
 public void StartTimer()
 {
  int i=0;
  while(true)//For Demo Purpose - Otherwise should use ManualResetEvent
  {
   if(i==0)
    timer1.Start();
   i++;
  }
 }
}

public class MainApp
{
 public static void Main() 
 {
   WithTimer m_Timer = new WithTimer();
   Thread _Thread1 = new Thread{new ThreadStart(m_Timer.StartTimer)};
   _Thread1.background = true;
   _Thread1.Start();
   _Thread1.Abort();
 }
}


Now as you can see in the code, after _Thread1.Abort(), i realise that m_timer events still gets called, even after the Thread has exited gracefully.
This ONLY happens with the Timer events. Anyone know why this is happening ?
Any solutions to this ?


Stanley
GeneralRe: Threads and System.Timers.Timer - Problems Pin
S. Senthil Kumar1-Jul-05 21:22
S. Senthil Kumar1-Jul-05 21:22 
GeneralRe: Threads and System.Timers.Timer - Problems Pin
stan283-Jul-05 7:37
stan283-Jul-05 7:37 
GeneralRe: Threads and System.Timers.Timer - Problems Pin
leppie2-Jul-05 6:47
leppie2-Jul-05 6:47 
GeneralRe: Threads and System.Timers.Timer - Problems Pin
stan283-Jul-05 7:40
stan283-Jul-05 7:40 
GeneralPlz Help on Net Send Pin
Member 122691721-Jul-05 19:18
Member 122691721-Jul-05 19:18 
GeneralRe: Plz Help on Net Send Pin
Dario Solera1-Jul-05 23:40
Dario Solera1-Jul-05 23:40 
GeneralIntegration of Window Service and my project through set up program Pin
ksanju10001-Jul-05 19:09
ksanju10001-Jul-05 19:09 
GeneralRe: Integration of Window Service and my project through set up program Pin
mav.northwind1-Jul-05 20:10
mav.northwind1-Jul-05 20:10 
GeneralHey all, i have a bit of a problem with event handlers... Pin
tom_dx1-Jul-05 16:43
tom_dx1-Jul-05 16:43 
GeneralRe: Hey all, i have a bit of a problem with event handlers... Pin
ACorbs1-Jul-05 17:02
ACorbs1-Jul-05 17:02 
GeneralSorting problem Pin
damir_tk1-Jul-05 11:25
damir_tk1-Jul-05 11:25 
GeneralRe: Sorting problem Pin
Guffa1-Jul-05 12:34
Guffa1-Jul-05 12:34 
GeneralDynamic Menus in C# Pin
0ryan01-Jul-05 9:08
0ryan01-Jul-05 9:08 
GeneralRe: Dynamic Menus in C# Pin
rudy.net1-Jul-05 18:01
rudy.net1-Jul-05 18:01 
GeneralSendMessage Pin
ladwah1-Jul-05 8:46
ladwah1-Jul-05 8:46 
GeneralRe: SendMessage Pin
Judah Gabriel Himango1-Jul-05 9:47
sponsorJudah Gabriel Himango1-Jul-05 9:47 
GeneralRe: SendMessage Pin
ladwah1-Jul-05 10:36
ladwah1-Jul-05 10:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.