Computing.Net > Forums > Programming > Countdown timer in VB6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Countdown timer in VB6

Reply to Message Icon

Name: Richard_Sheath
Date: February 8, 2006 at 17:48:07 Pacific
OS: XP SP2
CPU/Ram: P4 3ghz 1024mb
Comment:

I wish to have a 5 minute countdown on a form in VB6 that can be overidden by a button click that then shells out to a windows installer. If the end user does not click the button then the Windows installer happens anyway.

Anyone help?

I've done the Windows installer shelling out ok, just need help withthe timer



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: February 9, 2006 at 02:32:01 Pacific
Reply:

Set you time to count for 6000. That will give a one minute delay.

Create a public variable and initiate it to five.

When the time is activated after each minute, decrease the public variable. When it reaches zero, you have your five minute delay and you can act appropriately.

To override the timer just disable the timer in the button click event.

Stuart


0

Response Number 2
Name: jhunt303
Date: February 22, 2006 at 09:10:54 Pacific
Reply:

Dimension a Date Stamp to a variable then add 5 minutes to it, just run a timer to check the value and when it matches, hey presto


0

Response Number 3
Name: StuartS
Date: February 22, 2006 at 10:25:04 Pacific
Reply:

Which is better - a 16 bit integer variable or a 64 bit Date variable?

Which does a faster comparison - at an Integer or a Date variable.

Personally, I would use a 16 bit variable. Foster, less overheads and simple to implement.

Actually there is a small error in my original post. It should be 60000, not 6000. 6000 will only give a six second delay. 60000 will give a 1 minute delay.

Stuart


0

Response Number 4
Name: jhunt303
Date: February 23, 2006 at 08:31:20 Pacific
Reply:

You have a bit more control with DateTime variables, you can always convert the minute and seconds to an SByte.

A neat trick is to increase the frequency of checking as you approach the value of time you need, this can lead to a very accurate event with minimized overhead.

The count function is a little more appropriate for Thread timings


0

Response Number 5
Name: StuartS
Date: February 23, 2006 at 11:37:51 Pacific
Reply:

As the DateTime variable is only has resolution of one second and the Timer has a resolution of 1000th of a second, I dont see how using a DateTime variable can inprove on an Integer variable. You can just as easy increas the frequency of checking with an Integer variable. The only limitation is that you canot time events longer than around 22 days.

32767 /60 /24

Bear in mind that Date/Times are stored in Windows as a double precision floating point number.

What's an Sbyte?

Stuart


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Countdown timer in VB6

Random colors in VB6 form www.computing.net/answers/programming/random-colors-in-vb6-form/10627.html

Countdown Timer. www.computing.net/answers/programming/countdown-timer/13369.html

need a library automation project in vb6 www.computing.net/answers/programming/need-a-library-automation-project-in-vb6/1385.html