any language
Create one object –Person, and code it. Create the menus shown in the demo program. The interface is a bit different from what you have done to this point. Play with the program to see how it works. The hungarian notation for a date control isdte.
Commands
The key commands of this program are:
Add a Person
Remove a Person
Display next person
Display previous person
Display first person
Display last person.
Create the programming to make these components work. Refer to the power point notes for examples of how the code needs to be set up.
Protecting Data against Accidental change
Change the display to allow the user to enter data into text boxes, but protect the data from being accidentally changed by setting the ReadOnly property of the text boxes appropriately. This should be a sub. Call it as you need it. The Date has no ReadOnly property, use the Enabled property instead for this control. Use the enabled property for the Date/Time picker.
Age Calculation
Calculate the age of the individual in the Person object and display it in the age label as we change who we are looking at. The functions you need are:
Now() – gives the current date. It has several helpful properties
Month – the month of the date in the data
Day – the day of the date in the data
Year – the year of the date in the data
Remember the age depends on whether the day and month of the birthday has already occurred in the current year. The age determination should code like this:
If Birth.Month < now.month="">
Age = Now.Year – Birth.Year ‘Have had birthday
ElseIf birth.Month = Now.Month And birth.Day <= now.day="">=>
Age = Now.Year – Birth.Year ‘Have had birthday
Else
Age = Now.Year – Birth.Year – 1 ‘Haven’t had birthday yet
End If
Where should you place this code in the Person object?