Microsoft KB Archive/161139

= PRB: Custom ActiveX Property Sheet Entries Are Not Saved =

Article ID: 161139

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q161139



SYMPTOMS
ActiveX control property changes entered via a property page are not saved. However, if you enter the properties via the standard property pane that comes with Visual Basic, the changes are saved.



CAUSE
The UserControl needs to explicitly inform the host development environment of any property changes that are made via property pages or are side effects of other property changes.



RESOLUTION
To tell the host development environment of property changes, the UserControl must invoke the PropertyChanged method of the Extender object.



STATUS
This behavior is by design.



MORE INFORMATION
When entering properties via the standard property pane, the host application is setting the properties for your control and, therefore, knows they have been changed.

The host application knows nothing about changes you make via property pages or that there are side effects of other property changes. The user control needs to explicitly tell the host application that properties have been changed, so it can see the changes and save them.

The following example illustrates setting properties:

-- in the property page -- Private Sub LabelCaption_Changed Changed = True    ' Enable Apply button End Sub

Private Sub ApplyChanges Dim X As Variant For Each X In SelectedControls X.Caption = LabelCaption.Text Next X     End Sub -- in the user control -- Public Property Let Caption(ByVal NewVal As String) lblMain.Caption = NewVal PropertyChanged "Caption" End Sub This code assumes that you have all other supporting code working, such as the InitProperties, ReadProperties, and WriteProperties events.

