title: How bad is it to open a new Form using System.Timers.Timer?
body: <p>My c# WinForm application uses the Elapsed event of a System.Timers.Timer to open a new form. It was pointed out to me (in an earlier <a href="https://stackoverflow.com/questions/3275527/mutex-not-releasing">question</a> I posted on a different topic) that this was a bad idea; it was suggested I use System.Windows.Forms.Timer.</p>
  
  <p>I've changed my code in response to this suggestion and my application appears to work; however, I'm still rather low on the WinForms learning curve and I'd enjoy feedback on whether or not I've correctly changed my code. (I'm concerned because the old way--the bad way--also appeared to work.)</p>
  
  <p>I have two forms: frmTimer and frmUser.  Each form resides in a separate project in the WinForms solution.  FrmTimer uses the namespace 'svchostx' and runs from svchostx.exe.  FrmUser uses the namespace 'XXXUser' and runs from XXXUser.exe (where XXX is the application's name).</p>
  
  <p>Is it bad to use System.Timers.Timer in this context and, if it is, then have I made the correct changes?</p>
  
  <p>In frmTimer this code:</p>
  
  <pre><code>this.tmTimer= new System.Timers.Timer();
  ((System.ComponentModel.ISupportInitialize)(this.tmTimer)).BeginInit();
  // 
  // tmTimer
  //
  this.tmTimer.Interval = 20000;
  this.tmTimer.SynchronizingObject = this;
  this.tmTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.tmTimer_Elapsed);
  private System.Timers.Timer tmTimer;
  
  private void tmTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
  </code></pre>
  
  <p>Was replaced with this code:</p>
  
  <pre><code>this.timer1 = new System.Windows.Forms.Timer(this.components);
  // 
  // timer1
  // 
  this.timer1.Interval = 20000;
  this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
  private System.Windows.Forms.Timer timer1;
  
  private void timer1_Tick(object sender, System.EventArgs e) {
  </code></pre>
  
  <p>In both the old code and the new code, the timer event checks to see if certain conditions are meet, and when they're meet, then frmUser is opened.  FrmUser shows a quiz screen (with math or spelling questions) that the user answers.  FrmTimer is never seen and contains only logic to determine when frmUser is opened.</p>
  
  <p>Also, Visual Studio's IntelliSense says this about System.Windows.Forms.Timer: "This timer is optimized for use in Windows Forms applications and must be used in a window."  The last part of that sentence confuses me because frmTimer doesn't really have a window (the form is never seen).  I'm not sure what is meant by 'must be used in a window'--yes, I am pretty low on the learning curve.</p>
  
  <p>Any advice or help here is appreciated.</p>