Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Convert to Date data type</h2> <p>The issue seems to be that the <code>remind</code> variable is a <a href="http://msdn.microsoft.com/en-us/library/9e7a57cf%28v=vs.85%29.aspx" rel="nofollow">String</a> data type, and the <code>check</code> variable is a <a href="http://msdn.microsoft.com/en-us/library/9e7a57cf%28v=vs.85%29.aspx" rel="nofollow">Date</a> data type. When you try to compare them, they'll always fail to be equal, even if the actual date inside both types is the same.</p> <p>You can solve the problem by using the <a href="http://msdn.microsoft.com/en-us/library/2dt118h2%28v=vs.85%29.aspx" rel="nofollow">CDate</a> function to convert <code>remind</code> to a Date before entering the loop. </p> <pre class="lang-vb prettyprint-override"><code>remind = CDate(remind) </code></pre> <h2>Validation</h2> <p>Because you're now using CDate to convert the user's input, if they make a typo and enter an invalid date, its going to bring up an error box and end the program. You may want to use <a href="http://msdn.microsoft.com/en-us/library/48y0723t%28v=vs.85%29.aspx" rel="nofollow">IsDate</a> to ensure it is a valid time before converting it, then gracefully ask the user to enter the time again if they made a typo.</p> <h2>CPU Usage</h2> <p>Your loop will sit there taking up 100% CPU usage of one core of the machine its running on. This can slow down your user's computer, among other side effects.</p> <p>To fix this issue, you want to slow down the loop, such that its only checking a few times a second, rather than a few hundred times a second. Insert this statement inside the loop to have it sleep for 500 milliseconds before trying again.</p> <pre class="lang-vb prettyprint-override"><code>WScript.Sleep 500 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload