title: Timer variable is null which is declared for countdown timer?
body: <p>I have this code which is used for countdown in C#. I can't seem to find why my variable t is null. I tried this code on a separate project and it works well. I tried to incorporate it into another project and it says that variable t is null.</p>
  <pre><code>public partial class tracker : Form
  {
      System.Timers.Timer t;
      int h1, m1, s1;
  
      public tracker()
      {
          InitializeComponent();
      }
  
      private void tracker_Load(object sender, EventArgs e)
      {
          t = new System.Timers.Timer();
          t.Interval = 1000; //1s
          t.Elapsed += OnTimeEventWork;
      }
  
      private void btnLogin_Click(object sender, EventArgs e)
      {
          t.Start();
          btnLogin.Enabled = false;
          richTextBox1.SelectionLength = 0;
          richTextBox1.SelectedText = DateTime.Now.ToString(&quot;MM/dd/yyyy\n&quot;);
          richTextBox2.SelectedText = &quot;Time In\n&quot;;
          richTextBox3.SelectedText = DateTime.Now.ToString(&quot;HH:mm:ss\n&quot;);
          richTextBox4.SelectedText = &quot;\n&quot;;
          richTextBox5.SelectedText = &quot;\n&quot;;
      }
  }
  </code></pre>