A Calendar Example Similar to Windows Date and Time properties

Dates and Math

Author: Anonymous

Version Compatibility: Visual Basic 6

More information:
This example is for anyone needing to understand the concept of dates in computing or calendar functionality. I have seen several examples of calendars, some that cannot even handle the 29th of February. You must have a date variable, set the date variable back and forward as needed, and use the date to set your controls. Most importantly, don’t make the date variable local to a sub or function. You'll need to reference it during the entire execution, so scope the variable accordingly. Here’s how to setup the project included below: Create a new project named normal.exe in VB6 and add the following controls to Form1: A Frame named MyFrame with caption = "" Command button named CmdPrevYear cap = "<<<" Command button named CmdPrevMonth cap = "<<" Command button named CmdPrevDay cap = "<" Command button named CmdNextYear cap = ">>>" Command button named CmdNextMonth cap = ">>" Command button named CmdNextDay cap = ">" Textbox named TxtYearAndMonth. Set the Locked attribute = True, BackColor = &H8000000A& and TabStop = False. Add a label named LbLWeekDay, and set its index property to 0, and it's font to 10 + bold. ADD a small frame inside the first Frame above named FrmD and set it's index property to 0 (no caption). Finally add a small label inside the FrmD named LblD and set it's index property to 0, changing its font to 10 and bold.

Instructions: Copy the declarations and code below and paste directly into your VB project.