Object-Oriented Programming Project


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:

  1. Test to make sure the month and day values are valid (e.g., Calendar.SetDate 32 should be invalid). Don't go overboard and calculate based on what month of the year.
  2. Add a procedure to set the date, that takes three parameters: month, day, and year.
  3. Add a function that returns the date in 12/25/76 format.
  4. Add a procedure that accepts the date in string format, as "12/25/1976"

Visual Basic by Example is hosted by GeoCities
1