[VB6] How do I Count down time?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: [VB6] How do I Count down time?

  1. #1
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,091

    Question [VB6] How do I Count down time?

    Q: How do I Count down time?

    A: This is actually a very simple process. Just add a Timer and a label to your form, make sure the Timer is enabled than add the following code to your form :

    Code:
    Option Explicit
    
    'Create CountDown Object
    Dim Countdown As Date
    
    Private Sub Form_Load()
    
        Timer1.Interval = 1000 'One Second
        Countdown = "12:00:00" 'What Time To Start From
    
    End Sub
    
    Private Sub Timer1_Timer()
    
        Countdown = Countdown - (1 / 24 / 60 / 60) 'Subtract Seconds
        Label1.Caption = Format(Countdown, "hh:mm:ss") 'Display
        
    End Sub
    A full working sample is included in this post
    Attached Files Attached Files

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center