title: C# How to run code at given time?
body: <p>To put it simply,</p>
  
  <p>I start running my C# program in the morning, and the program should show the user a message at 5:45 PM. How can I do this in C#?</p>
  
  <p>Edit: I asked this question because I thought using a timer is not the best solution (comparing the current time periodically to the time I need to run the task):</p>
  
  <pre><code>private void timerDoWork_Tick(object sender, EventArgs e)
  {
      if (DateTime.Now &gt;= _timeToDoWork)
      {
  
          MessageBox.Show("Time to go home!");
          timerDoWork.Enabled = false;
  
      }
  }
  </code></pre>