Home > Articles > Web Services > XML

  • Print
  • + Share This
From the author of

Tracking Forms

Just as the customer list form's SessionState only stores information for the form's interesting properties, the program doesn't need to store information about uninteresting forms. When the user restarts the program, he builds a new customer list and then selects a customer to examine. There's no point in the program saving information about customer detail forms. Not only will the user probably not need to look at those customers tomorrow, the customers' data may have been modified by then. The user needs to reopen any customer forms he wants to use.

This program stores session state for the main MDI form, the customer list form shown in Figure 1, and the employee list form (which is similar). It doesn't store information for customer or employee detail forms.

The program's m_Forms collection keeps track of the forms that should be saved. When it creates a new customer or employee list form, the main program adds a reference to the form to the m_Forms collection. When one of those forms closes, it removes itself from this collection.

When the program needs to save the session state for the entire application, it loops through m_Forms to find the forms it needs to save.

  • + Share This
  • 🔖 Save To Your Account