Results 1 to 8 of 8

Thread: [RESOLVED] Running Stopwatch with Date & Time

Threaded View

  1. #1

    Thread Starter
    Addicted Member Quizton's Avatar
    Join Date
    Dec 2005
    Location
    VB Forums
    Posts
    209

    Resolved [RESOLVED] Running Stopwatch with Date & Time


    Hello All,

    I am working on a stopwatch program to record times for various job's
    and am having trouble setting the start and stop to count off the date & Time
    any info would be greatly appreciated
    So far I have txtDate & TxtTime set to systemtime
    VB Code:
    1. Private Sub Timer1_Timer()
    2.     txtDate = Date
    3.     txtTime = Time
    4. End Sub
    5.  
    6. Private Sub Form_Load()
    7.     Timer1.Enabled = True
    8.     EmpClock.Enabled = True
    9. End Sub

    and then I am usin cmdStart & cmd Stop
    and txtStart , txtStop, & txtTotal wich will be of course txtstarttime + txtstoptime
    the issue is setting start & stop off the txtTime
    this is what ive got on this part so far
    VB Code:
    1. Dim hour As Single
    2. Dim min As Single
    3. Dim sec As Single
    4.  
    5. Private Sub cmdStart_click()
    6. EmpClock.Interval = 1000
    7. 'Need Something to Help Start timer off current time txtTime and place into txtStart
    8. End Sub
    9.  
    10. Private Sub cmdStop_Click()
    11. 'Need Something to Help Stop Timer and take current time & place into txtStop then I should be able to find the difference and place into txtTotal
    12. End Sub
    13.  
    14. Private Sub EmpClock_Timer()
    15.  
    16. If min = 60 Then hour = hour + 1: min = 0
    17. If sec = 60 Then min = min + 1: sec = 0
    18.  
    19. txtStart.Text = Format(Str(hour), "00") & ":" & _
    20. Format(Str(min), "00") & ":" & _
    21. Format(Str(sec), "00")
    22. txtStop.Text = Format(Str(hour), "00") & ":" & _
    23. Format(Str(min), "00") & ":" & _
    24. Format(Str(sec), "00")
    25. txtTotal.Text = Format(Str(hour), "00") & ":" & _
    26. Format(Str(min), "00") & ":" & _
    27. Format(Str(sec), "00")
    28. End Sub
    29. Private Sub cmdReset_Click()
    30. txtStart.Text = "00.00.00"
    31. txtStop.Text = "00.00.00"
    32. txtTotal.Text = "00.00.00"
    33. hour = 0
    34. min = 0
    35. sec = 0
    36. End Sub

    thanks for any help on this
    Last edited by Quizton; Jan 24th, 2006 at 02:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width