VB6Delegate Events
' Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As _
   PropertyBag)
   Call PrivateMDI_LoadProperties(PropBag)
End Sub

' Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As _
   PropertyBag)
   PrivateMDI_StoreProperties PropBag
End Sub

Private Sub PrivateMDI_LoadProperties(P As PropertyBag)
   FirstNumber = P.ReadProperty("FirstNumber", _
      m_def_FirstNumber)
   SecondNumber = P.ReadProperty("SecondNumber", _
      m_def_SecondNumber)
End Sub

Private Function PrivateMDI_ProgID() As String
   PrivateMDI_ProgID = App.Title & "." & UserControl.Name
End Function

Private Sub PrivateMDI_StoreProperties(P As PropertyBag)
   Call P.WriteProperty("FirstNumber", m_FirstNumber, _
      m_def_FirstNumber)
   Call P.WriteProperty("SecondNumber", m_SecondNumber, _
      m_def_SecondNumber)
End Sub
Listing 4 This is the property persistence for a control that has two Integer properties. The UserControl events are delegated to the interface methods. The ProgID method obtains the programmatic ID of the control so the MDI application can determine the document type for the child form.