PropertyBag Equivalents for Visual Basic 6.0 Users

The Visual Basic 6.0 PropertyBag object is replaced by the My.Settings object in Visual Basic 2008.

Conceptual Differences

In Visual Basic 6.0, the PropertyBag object is used to persist an object's data between instances, allowing you to store values and retrieve them the next time the object is instantiated. Although you can set an object's properties to a default value at design time, any values entered at run time are lost when the object is destroyed. The Visual Basic 6.0 PropertyBag object allows a copy of the object to be persisted in a binary format and retrieved for later reuse. For example, an application used to calculate loans might use a PropertyBag object to persist an interest rate between instances, rather than requiring a user to enter it each time the application is run.

In Visual Basic 2008, the PropertyBag object no longer exists, but you can still persist an object's data by using the My.Settings object. The My.Settings object provides access to a component's or application's settings, and it allows you to dynamically store and retrieve property settings and other information at design time and run time. For more information, see Managing Application Settings.


The My.Settings object can only be used to persist data in types defined by the .NET Framework. For custom data types, you can use serialization to persist the data. For more information, see Walkthrough: Persisting an Object in Visual Basic.

See Also


User Controls for Visual Basic 6.0 Users