|
Creating a timer string
Requirements: Microsoft Visual Basic (done in 6.0 though most
if not all versions should be fine)
Using a timer is fine, but it is restricted to a maxium length of 60 seconds.
If you want to timer for longer than this you need to create a string of timers,
using a knock on effect or something similar. The easiest method is as follows.
I may come back to this in later issues and show you can this can be done but
using only one timer as the problem with this method is, if you want to time
for a long time, you need a lot of timers. For now though so if this method
will work for you:
Method 1: Multipul timers
The easiest thing to do is create a knock on effect where one timer turns on
the next. Say if you wanted to change the title of an application after 3 minutes,
this could be done with 3 timers set to 60 seconds each. Set all the timers
to disabled at the start.
On form load:
Timer1.Enabled = True
In Timer1:
Timer2.Enabled = True
Timer1.Enabled = False
In Timer2:
Timer3. Enabled = True
Timer2.Enabled = False
In Timer3:
Me.Caption = "New application title"
Timer3.Enabled = False
This would only do it once. If you wanted to keep the cycle going so you could
update the applications title every 3 minutes based on a run time variable such
as the title of a web page the user was one, just add:
Timer1.Enabled = True
To Timer3, so once the cycle is completed, it will activate Timer1 again and
begin the cycle once more. |