1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VB6 Clock

Discussion in 'Software Development' started by B3gbie, Dec 3, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. B3gbie

    B3gbie Thread Starter

    Joined:
    Nov 30, 2001
    Messages:
    228
    Anybody know how to get a clock with time and date onto a label and update every second, i can do it at form load, but the time remains the same as long as that form is displayed. Thanks
     
  2. owen68

    owen68

    Joined:
    Nov 19, 2001
    Messages:
    10
    You need to use the timer control
     
  3. TimCottee

    TimCottee

    Joined:
    Oct 10, 2001
    Messages:
    186
    There are a couple of ways to do this: one is to add a statusbar control on the form and set one of the panels to time style.

    The other as already mentioned is to use a timer control:

    Private Sub Timer1_Timer()
    Label1.Caption = Now()
    End Sub

    Private Sub Form_Load
    With Timer1
    .Enabled = True
    .Interval = 500
    End With
    End Sub

    This sets the timer to fire approx every 1/2 second so the clock display is likely to be accurate to that kind of resolution.
     
  4. B3gbie

    B3gbie Thread Starter

    Joined:
    Nov 30, 2001
    Messages:
    228
    Thanks guys, thats a big help. I's always the smallest things that pose the biggest problems.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/60511

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice