I gave my time interval as 100. when the timer elapsed the message box is displayed but my screen is flooded with message boxes. How should i stop it with one message box indicating timer elapsed. Here's my code... Can you guide me where to give stop timer...
namespace timer1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
Timer t = new Timer();
t.Interval = 100;
timer1.Enabled = true;
timer1.Tick += new System.EventHandler(OnTimerEvent);
}
private void OnTimerEvent(object sender, EventArgs e)
{
MessageBox.Show("time over");
}
}
}