Tuesday, September 28, 2010

Running from a Schedule in C#

This snippet shows you how to schedule a given command in C#. First you need two controls for time. We'll name them both txtDate and txtTime in this example. txtDate and txtTime are both short date and short time controls.  This snippet just compares the txtTime/txtDate with the current time, and then if the condition is met it runs the subroutine.

if (DateTime.Now.ToShortDateString() ==
         txtDate.Text && 
         DateTime.Now.ToLongTimeString() ==
                    runmelater = false;
                    this.runCommand(Password1, UserName1, Command1);

No comments:

Post a Comment