[TuT] Date and Time in Visual Basic 6.0 [TuT]

Discussion in 'Programming' started by Neova, Jan 13, 2008.

  1. #1
    This tutorial will show you how to make a clock that tells the time and the date in Visual Basic 6.0

    STEP 1
    - Open up a Standard EXE.
    - Entitle the caption of the form to 'Clock'.
    - Rename 'Form1' to 'frmClock'.

    STEP 2
    - Make your GUI, in the style you want or whatever.
    - Add:
    [] 2 Labels with the captions:
    Date
    Time


    Make sure that the labels match the Forecolour and the Backcolour of your form.

    STEP 3
    - Add 2 more labels next to the 'Date' and 'Time' labels.
    Set the BorderStyle to '1 - Fixed Single.'
    - In both of these labels, clear the text, so it's blank.
    - Make sure the ForeColour and the BackColour match your form.

    STEP 4
    - Rename the 'Date' label you set in Step 3, to 'lblDate'.
    - Rename the 'Time' label you set in Step 3, to 'lblTime'.

    STEP 4
    - Add 1 Timer, and rename it to 'tmrTimeDate'.
    - Set the 'Interval' to '100'.
    - Double click the Timer, and add the following code:
    lblTime.Caption = Time
    lblDate.Caption = Date
    Code (markup):
    That's all you need. =]
    Simple eh?

    I'd put screenshots on, but I need to re-install Photoshop, so it'll have to wait :p.

    Please post feedback.

    Regards,
    -Hammad-
    (Yeah, I'm -Hammad-.
    Moderators banned me for no reason :D).
     
    Neova, Jan 13, 2008 IP