The InitProperties event is only raised once; When the control is added to a form.
You must store the property values in the PropertyBag that is passed to the ReadProperties and WriteProperties events.
When a property changes call the PropertyChanged method and pass the name (string) of the property.
Here's a simple example of a user control that has a Caption property:
Good luck!Code:Dim m_Caption As String Public Property Get Caption() As String Caption = m_Caption End Property Public Property Let Caption(ByVal New_Caption As String) m_Caption = New_Caption UserControl.Cls UserControl.Print New_Caption PropertyChanged "Caption" End Property 'Initialize Properties for User Control Private Sub UserControl_InitProperties() 'set the Caption property to the extender name Me.Caption = Extender.Name End Sub 'Load property values from storage Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Me.Caption = PropBag.ReadProperty("Caption", "") End Sub 'Write property values to storage Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("Caption", m_Caption, "") End Sub




Reply With Quote