|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Creating a kind of clock in VB6 Hello everyone, I'm trying to create a program in visual basic 6 that when you clicked the button "Start" begins to count the time (hh-mm-ss) and at the same time, starting from 14m and 59s, I stop that time up to 0m and 0s where, at that point, an increase of one meter, and again the time to climb from 0. I managed to write a great piece of code and runs so good ...... for the first 5 / 6 minutes, after which the time begins to have less than 2 seconds, and the countdown of 15m to be over 2 seconds the normal (I used a stopwatch to check). I tried a couple of solutions but the code seem right way. So I ask you experts if you can solve this problem. Or if you know another way to build this program. If you wanted to see the code here i have written it.Please go through it. |
#2
| |||
| |||
Re: Creating a kind of clock in VB6 Hello, I think the problem is due to the fact that the timers are not perfect in the sense that if you put a timer that fires every second in this reality triggered at times after 1000 ms, sometimes after 1002 ms, and so forth. There is a margin of error. For a program of this kind should in sync with the system clock. I do not know how to do it in VB6, you should still search for information in this regard. |
#3
| |||
| |||
Re: Creating a kind of clock in VB6 Small example: we have a simple form with this code: Code: Private startDate As Date Private secAuto As Integer Private secSys As Integer Private Sub cmd_start_Click () secAuto = 0 secSys = 0 startDate = Now Timer_auto.Enabled = True Timer_sys.Enabled = True End Sub Private Sub Timer_auto_Timer () secAuto = secAuto + 1 lbl_auto.Caption = secAuto End Sub Private Sub Timer_sys_Timer () secSys = DateDiff ( "s", startDate, Now) lbl_sys.Caption = secSys End Sub If you want to be always synchronized with the system using the second method (Timer_sys). Furthermore, it is not necessary to hold the 1000 range of Timer_sys, but since the increase is always done on a comparison with the timer system, you can use more specific intervals (50 ...) |
#4
| |||
| |||
Re: Creating a kind of clock in VB6 ah, thank you very much I understood.. But I never used the DateDiff does, in fact if I make a form like the one showing you mistake me. Not that I have to make some API to use DateDiff? |
#5
| |||
| |||
Re: Creating a kind of clock in VB6 Quote:
Sure I did everything as in? |
![]() |
|
Tags: programing language, vb 6, visual basic 6 |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What all different kind of pen you are using on Asus EA800? | DougWison | Portable Devices | 4 | 10-08-2011 08:42 PM |
What kind of user needs SAN | Sharanya | Networking & Security | 5 | 18-03-2010 03:02 AM |
Is ????????.??? some kind of a virus?? | Bansi_WADIA | Networking & Security | 3 | 20-11-2009 06:27 AM |
Error 'This server's clock is not synchronized with the primary domain controller's clock' | Akiraa | Networking & Security | 3 | 22-07-2009 09:14 PM |
What kind of processor do you buy? | manishdk | Polls & Voting | 1 | 15-12-2008 07:53 PM |