First off, understand that this is a rather artificial example. There's really no "purpose" in the program itself.
Write a program that contains a Class Module named Calendar
. It should include the following procedures:
Sub SetMonth (month As Integer) Sub SetDay (day As Integer) Sub SetYear (year As Integer) Function GetDate () As String
The Class Module should have some variables to store the month, day, and year. The GetDate
function should return a string that looks something like "12/25/1976
" if the appropriate values for Christmas Day, 1976 were used in the SetMonth
, SetDay
, and SetYear
procedures.
This program should also include a form that looks like this:
The Set
button should take the values of the textboxes and call the Set procedures in the Calendar Class Module, while the Display
button should display the result of the GetDate
function in the label at the bottom of the form.
Extra Improvements:
Calendar.SetDate 32
should be invalid). Don't go overboard and calculate based on what month of the year.