Ok,
- create a new ActiveX dll project in VB
- rename the Class1 class to MyProperties
- set the class Persistable attribute in the property browser to "1 - Persistable"
- add some properties
- select "Class" from the top-left combo box in the source code window
- select ReadProperties and WriteProperties from the top-right combo
- implement the serializaton of properties through the PropertyBag passed above
The end result should look like
'local variable(s) to hold property value(s)
Private mvarStringProperty As String 'local copy
Private mvarPictureProperty As StdPicture 'local copy
Public Property Set PictureProperty(ByVal vData As StdPicture)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.PictureProperty = Form1
Set mvarPictureProperty = vData
End Property
Public Property Get PictureProperty() As StdPicture
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.PictureProperty
Set PictureProperty = mvarPictureProperty
End Property
Public Property Let StringProperty(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.StringProperty = 5
mvarStringProperty = vData
End Property
Public Property Get StringProperty() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.StringProperty
StringProperty = mvarStringProperty
End Property
Private Sub Class_Initialize()
StringProperty = ""
Set PictureProperty = Nothing
End Sub
Private Sub Class_ReadProperties(PropBag As PropertyBag)
StringProperty = PropBag.ReadProperty("String")
Set PictureProperty = PropBag.ReadProperty("Picture")
End Sub
Private Sub Class_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "String", StringProperty
PropBag.WriteProperty "Picture", PictureProperty
End Sub
Stoyan