About Step 3

Step 3 teaches:

  • The basics of adding, editing, and deleting records.

  • How to implement commands for these operations.

Up to now Enroll has supported editing (updating) records but not adding or deleting records.

There are many different user-interface styles for adding records. For example, when a Microsoft Access user reaches the end of a recordset, Access considers the next record to be a new record. Other applications have an explicit Add command. Enroll’s user interface is only one among many possible user interfaces that you might implement using MFC.

The user interface in Step 3 includes three new commands on the Record menu, with corresponding toolbar buttons:

  • The Add command prepares a blank record into which the user enters data. The user saves the new record by moving to another record, just as he or she saves an edited record by moving to another record. The user can also save the new record by issuing the Add command again.

  • The Refresh command abandons an operation to add or edit a record. Refresh restores the modified record to its original state or returns to the record shown before Add.

  • The Delete command deletes a record.

To try Step 3 now, run Enroll.exe from the Samples directory on the distribution CD. For more information, see Previewing the Sample Applications in Scribble Lesson 1. Note that if you are running the DaoEnrol tutorial, you will first need to set up the data source. See the section Setting Up the Student Registration Data Source in Enroll Lesson 1.

The figure below shows the finished Enroll application.

The Enroll Step 3 Application

Here are some things to try:

  • Try the new Add, Refresh, and Delete commands.

  • Try forcing the two exceptions handled by Enroll:

    • Try to delete a section that has Enrollment records.

    • Try to add a duplicate section.

When you finish, exit the program.