PRB: Custom ActiveX Property Sheet Entries Are Not SavedLast reviewed: March 24, 1997Article ID: Q161139 |
The information in this article applies to:
SYMPTOMSActiveX 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.
CAUSEThe 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.
RESOLUTIONTo tell the host development environment of property changes, the UserControl must invoke the PropertyChanged method of the Extender object.
STATUSThis behavior is by design.
MORE INFORMATIONWhen 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 SubThis code assumes that you have all other supporting code working, such as the InitProperties, ReadProperties, and WriteProperties events.
REFERENCESMicrosoft Visual Basic Online Help, PropertyChanged Method Microsoft Visual Basic Component Tools Guide, Chapter 9, Building ActiveX Controls, Adding Properties to Controls, Implement Control Properties Using Property Procedures |
Keywords : kbprg vb5all vb5howto VBKBAX VBKBProgramming kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |