473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can I pause and resume my countdown timer?

1
i have this code downloaded from other site, but im not sure how to create a Pause and Resume function for this timer

all i have is the code for pause.
Expand|Select|Wrap|Line Numbers
  1. tmrWait.enabled= false
  2.  
  3. '--------ACTIVATE TIMER
  4. Private Sub cmdstartTimer_Click()
  5. Dim fields() As String
  6. Dim hours As Long
  7. Dim minutes As Long
  8. Dim seconds As Long
  9.  
  10.  
  11.     fields = Split(txtduration.Text, ":")
  12.     hours = fields(0)
  13.     minutes = fields(1)
  14.     seconds = fields(2)
  15.  
  16.     m_StopTime = Now
  17.     m_StopTime = DateAdd("h", hours, m_StopTime)
  18.     m_StopTime = DateAdd("n", minutes, m_StopTime)
  19.     m_StopTime = DateAdd("s", seconds, m_StopTime)
  20.  
  21.     tmrWait.Enabled = True
  22.  
  23. End Sub
  24.  
  25.  
  26. '------TIMER
  27.  
  28. Private Sub tmrWait_Timer()
  29. Dim time_now As Date
  30. Dim hours As Long
  31. Dim minutes As Long
  32. Dim seconds As Long
  33.  
  34.     time_now = Now
  35.     If time_now >= m_StopTime Then
  36.         'MsgBox ("Timer Ended!")
  37.         'Me.WindowState = vbMaximized
  38.         'cmdGetMP3s_Click (0)
  39.         Delete
  40.         tmrWait.Enabled = False
  41.         lblremaining.Caption = "0:00:00"
  42.     Else
  43.         seconds = DateDiff("s", time_now, m_StopTime)
  44.         minutes = seconds \ 60
  45.         seconds = seconds - minutes * 60
  46.         hours = minutes \ 60
  47.         minutes = minutes - hours * 60
  48.  
  49.         lblremaining.Caption = _
  50.             Format$(hours) & ":" & _
  51.             Format$(minutes, "00") & ":" & _
  52.             Format$(seconds, "00")
  53.     End If
  54. End Sub
  55.  
  56.  
when i use the tmr_wait.enabled= true code for resumes, it doesnt work..it seems that its because og the NOw function..
i really need your help guys..
thank you very much
Feb 14 '11 #1
0 1448

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bonnett | last post by:
I have been creating a generic countdown timer (source code below), counting the seconds, minutes, hours and days till an event, but I have having trouble with it finding out how many hours are...
4
by: Christine | last post by:
I've implemented a countdown timer for a tutorial web page that should give the user 45 minutes to complete the test, only to find that the timer is slowly 'losing' time. On average, it actually...
1
by: Will | last post by:
I have form showing instructions and logging actions and I would like the form to show a count down timer for a certain period of time. E.g. 30 secs, going down to 0 and then displaying the action....
1
by: Dirk Hagemann | last post by:
Hi! I'd like to implement a countdown timer on a webite. It should show the months, days, hours, minutes and seconds until a given date and time. So far it's not really difficult, but this...
1
by: enggars | last post by:
Hello. Is there any way to create a countdown timer in ASP pages? I am working on some quiz project, and it needs time limitation. I tried to use the javascript as the time limitation. But the...
1
by: DennyLoi | last post by:
Hi everyone. I am trying to implement a countdown timer which is displayed on my page. The counter needs to countdown from 10 seconds to 0 upon the page loading up. I tried the following, but...
9
nomad
by: nomad | last post by:
Hello everyone again: Ok I figured out the quiz section and now I need to but a timer on the test. if anyone knows how to do a countdown timer that will only lasts for 30mins(or what ever time)...
9
by: MC | last post by:
I would like to display a timer in the corner of the page that shows the user how many minutes:seconds till the session times out. Are there any good examples out there? Google has again failed...
4
by: hanaa | last post by:
Hi I am making a test taker. I need to put up a countdown timer, and I haven't a clue how. Could someone please help me start. I google it and all I see is readymade scripts that can be downloaded....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.