title: VB .NET run a thread at specified time everyday
body: <p>I am trying to run a background thread every 24 hours but I would like to run it at specific time say 10 am everyday.</p>
  
  <pre><code> Private Sub StartBackgroundThread()
      Dim threadStart As New Threading.ThreadStart(AddressOf DoStuffThread)
      Dim thread As New Threading.Thread(threadStart)
      thread.IsBackground = True
      thread.Name = "Background DoStuff Thread"
      thread.Priority = Threading.ThreadPriority.Highest
      thread.Start()
  End Sub
  </code></pre>
  
  <p>Rather than simply do a sleep for 24 hours as below, I need the thread to be called when 10 am is reached. I know a way may be checking something like Hour(Date.Now) = 10 and Minute(Date.Now) = 0, but I guess it is not a proper way to do this.</p>
  
  <pre><code>Private Sub DoStuffThread()
      Do
          DO things here .....
          Threading.Thread.Sleep(24 * 60 * 60 * 1000)
      Loop
  End Sub
  </code></pre>