Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 13

Using ReadProperties and WriteProperties Events and Corresponding Methods to Maintain Persistent Properties

The operating environment fires a UserControl's ReadProperties and WriteProperties events whenever it thinks that the instantiated object's properties need to be re-initialized (ReadProperties event fires) or stored for safekeeping (WriteProperties event fires).

This arrangement makes it much easier for you, the control author, to manage these properties since you don't have to think about all the possible occasions when property values might need reading or writing. You simply need to put code for reading and writing property values in two centralized places: the ReadProperties and WriteProperties event procedures.

Both the ReadProperties and WriteProperties event procedures receive a single parameter named PropBag. This PropBag parameter obviously represents the Property Bag object that holds the UserControl's property values.

The PropertyBag object represented by the PropBag parameter has one method for reading properties (ReadProperty) and another for writing properties (WriteProperty).

Usually, the only code you need to write in the ReadProperties event procedure will be a series of calls to the ReadProperty method so you can retrieve persistent values for individual properties.

Conversely, the only code you usually need to write in the WriteProperties event procedure will be a series of calls to the WriteProperty method so you can store persistent values of individual properties.


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved