For help with timers - Your questions are answered
I have written a program for those who ask about timers. This program should dis-spell the illusions some have about timers. Such as don't use DoEvents, or that their events happen on the scheduled interval set on the timer in all cases.
Look at the project and you will see exactly what happens with timers in three different cases.
With No code running in the timer
With Extended code running in the timer
With Extended code running with DoEvents in the timer
The display shows the elapsed time (in milliseconds) since the timer was last called. Now as you start out all the timers will show that they are on schedule. if you select the run code option the timers will start to flutter with different elapsed times. If you select run code with DoEvents you will notice that the timers settle back down to their normal elapsed time schedule. Play with it to sooth your fear and misconceptions about timers.
Hope this helps you with your timer code...
TIMERS WERE NOT MEANT TO KEEP TIME OR TIME ANYTHING!!!!
They just give you the luxury of interrupting code to check on events or set/check flags (basically).
Re: For help with timers - Your questions are answered
Not sure what you're trying to prove here:
- VB's Timers are not precise and it's being known for ages
- DoEvents is probably the worst function ever so if you want to use it then go ahead and do it at your own risk but at least utilize iterations
Re: For help with timers - Your questions are answered
RhinoBull,
Reading the post would exactly state what I am attempting to prove. Many people ask about the usage of these devices and need REAL answers. However you are entitled to your thoughts about DoEvent however wrong they have been PROVEN to be. I am just helping those who want to know how to use timers correctly and have similar mis-conceptions about them by proving TRUTH to the theories that can be duplicated repeatedly not just providing personal conjectures and speading fear about timers.
Re: For help with timers - Your questions are answered
I thinks its a great way to show how timers are an crap, and influence new programmers into using more accurate methods of calculating times, etc, you know what i mean.
And if that is what randem set out to do, i think he has succeded.
I myself am fairly new to programming, and have attempted to make programs before with the key component being the timer, never again.
Re: For help with timers - Your questions are answered
The timer is very useful...there is no reason not to use it. I dont think ive ever had the need to make a program that uses the time exactly to the milisecond...
Re: For help with timers - Your questions are answered
Timers can be useful if used properly. Most people inherently think that just because it has the word time in it, it should have something to do with time (GMT). WELL... IT DOESN'T. No more than if you set your alarm to go off in ten minutes that now it should keep the correct time. Not neccesarily so...
An alarm is more of what a timer represents nothing more. An indicator to do something. Not a time keeper.
Last edited by randem; Aug 22nd, 2005 at 10:48 PM.
Re: For help with timers - Your questions are answered
Nove,
It's not, but like everything else... it the if you don't understand it "Kill It" mentality. If used properly it is the only function that releases cpu cycles to other programs. Now some consider that bad because they want to hog all the CPU cycles because they think that makes their program faster.
Hey, but jumping off a tall building will get you down faster, but I will still take the elevator down!
Re: For help with timers - Your questions are answered
Originally Posted by |2eM!x
The timer is very useful...there is no reason not to use it. I dont think ive ever had the need to make a program that uses the time exactly to the milisecond...
Yeah, when WOULD you need a timer to time the exacly millisecond? I haven't used the timer that much, but none of the times has it had the need to be exactly accurate