// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Threading; namespace E { public class Program { public static void GotYou(Object sender, EventArgs evtargs) { Console.WriteLine(DateTime.Now); Thread.Sleep(1500); Console.WriteLine(DateTime.Now); } public static void Main(string[] args) { System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Interval = 1000; t.Tick += GotYou; Console.WriteLine("Start"); t.Start(); for(int i = 0; i < 1050; i++) { System.Windows.Forms.Application.DoEvents(); Thread.Sleep(10); } t.Stop(); Console.WriteLine("Stop"); } } }