Microsoft KB Archive/161237

= PRB: Apply Button on Custom OCX Property Page Always Disabled =

Article ID: 161237

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 Q161237



SYMPTOMS
When changing properties of a custom ActiveX control via a custom property page, the Apply button is never enabled.



CAUSE
The Changed property is not being set from the property page code.



RESOLUTION
In the property page code, add the line: Changed = True to all code that changes UserControl properties.



STATUS
This behavior is by design.



MORE INFORMATION
The Visual Basic IDE or run-time system controls the state of the Apply Button on your custom property pages. In order to tell Visual Basic that the user has edited one or more properties on a property page, you must set the PropertyPage object's Changed property to True. Because there is no way to know which property a user might decide to change, you must do this for every property displayed on the page.

The following code snippet illustrates using the Changed property in property page code: Private Sub ControlCaption_Changed Changed = True End Sub

Private Sub ApplyChanges Dim X As Variant For Each X In SelectedControls X.Caption = ControlCaption.Text Next X     End Sub This process can be simplified by using the Property Page Wizard from the Visual Basic Add-Ins menu.

