Create a timer in your class:
public partial class Form1 : Form
{...
Timer timer;
Initialize the timer in the class constructor:
public Form1()
{
InitializeComponent();
...
timer = new Timer();
timer.Interval = 100; //calls the fuction specified below every 100ms (1/10 sec)
timer.Tick += new EventHandler(CheckTime); //specify function to call every tick
timer.Start(); //start the timer
...
create the function to be called every tick and put Chris's code in it:
void CheckTime(object sender, EventArgs e)
{
DateTime theDate = DateTime.Parse("27 Mar 2008 00:26:00");
if (DateTime.Now => theDate)
{
MessageBox.Show((DateTime.Now).ToString());
timer.Stop(); //if the event is no longer to be checked for, stop the timer
}
}