| View previous topic :: View next topic |
| Author |
Message |
Hack-Addict Master Cheater
Reputation: 0
Joined: 20 Nov 2007 Posts: 287
|
Posted: Thu Aug 07, 2008 3:39 pm Post subject: (TuT-Visual basic 6) How to make a countdown timer |
|
|
Hey, so this is going to be a countdown tutorial.
We'll use:
A timer
A command button
A label
Ok, so bring your label, your timer and command button on the forum, rename the caption on the label to say, 60.
Rename the command button to whatever you want.
Now, open up the timer, and insert this code:
| Code: | | Label1 = val(label1.caption) - val(1) |
This will tell the label to countdown from whatever value it has in it.
Now put your timer set at 1000 for 1 second.
Now put this in for the command button
| Code: | If timer1.enabled = true then
Timer1.enabled = false
//This tells the timer to be enabled or disabled depending on if it's enabled or not.
command1.caption = "Whatever you want here"
//This tells the command button caption to be whatever you want when the timer's disabled or enabled.
Else
If timer1.enabled = false then
Timer1.enabled = true
Command1.caption = "Whatever you want here"
end if
end if
|
There you go, now you have your countdown timer.
_________________
|
|
| Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Thu Aug 07, 2008 3:42 pm Post subject: |
|
|
| That's pretty easy to make, and I'd use a integer variable to use as countdown, instead of a caption.
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Thu Aug 07, 2008 6:44 pm Post subject: |
|
|
| Moller wrote: | | That's pretty easy to make, and I'd use a integer variable to use as countdown, instead of a caption. |
use either Long (when your interval is bigger than 1000) or Single (when your interval is smaller than 1000) because Longs are fast, and Singles are good for divisions without having to round to the nearest integer.
_________________
Get kidnapped often. |
|
| Back to top |
|
 |
|