Timer continuously firing in C#, Not able to stop
<p>Could any one help me to stop my timer in windows form C3 application? I added timer in form using designer and interval is set as 1000; I would like to do some actions after 5 seconds of waiting after button click. Please check the code and advise me. Problem now is I get MessageBox2 infinitely and never gets the timer stop.</p>

<pre><code>static int count;

public Form1()
        {
            InitializeComponent(); 
            timer1.Tick += timer1_Tick;
        }
public void button1_Click(object sender, EventArgs e)
        {

        timer1.Enabled = true;

        while(count&gt;5)
         {
          ....dosome actions...
         }

        }
private void timer1_Tick(object sender, EventArgs e)
        {
            count1++;
           MessageBox.Show("Messagebox2");
           if (count1 == 5)
           {
               //timer1.Enabled = false; timer1.Stop(); 
               ((System.Timers.Timer)sender).Enabled = false;
               MessageBox.Show("stopping timer");
           }
        }
</code></pre>
