Changing my clock makes my app not compile?

S

Scott McNair

I'm writing a routine that does some cleanup whenever it senses a change in
the date. The only way to test my code is to set the date back to
yesterday at 11:59pm and observe the change as it occurs.

I did so, and noticed an error. So I altered my code to allow for the
error and rolled the clock back a minute or two, so that it was back to
11:59 yesterday. The same behavior occured.

So I put a MsgBox in the routine to alert me to what the value was for a
couple of variables, and I re-ran the app. The MsgBox never ran.

I moved the MsgBox to the very beginning of the routine. Still it wouldn't
fire.

I moved the MsgBox to the first line of the button event that fires the
routine. Still the MsgBox wouldn't fire.

I removed the MsgBox line, and added Exit Sub to the very beginning of the
button event. The button still called the routine.

I removed the Exit Sub line, and added MsgBox("loaded") to Form_Load. The
MsgBox never fired.

I reset the time to the current time and compiled, and everything worked
fine.

It seems as though .NET has some safeguard to keep you from compiling over
a newer version with an older version. Am I correct in this assumption?
 
J

Just_a_fan

Changing the clock time is dangerous and I would never recommend it.

Try just putting a checkbox on your form and whenever you click it,
trigger the cleanup.

Waiting for midnight is a pain. You only get one test per day. Canging
the clock is dangerous, too.

Try triggering the cleanup some other way if at all possible.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top