private void btnStartNDI_Click(object sender, EventArgs e) { myTimer1.Tick += new EventHandler(TimerEventProcessor); myTimer1.Interval = 1000; myTimer1.Start(); while (exitFlag == false) { Application.DoEvents(); } } public void TimerEventProcessor(Object myObject,EventArgs myEventArgs) { alarmCounter += 1; myTimer1.Stop(); myTimer1.Enabled = true; }