Microsoft KB Archive/192169

= BUG: Property Page Does Not Close Using Compiled VB OCX =

Article ID: 192169

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q192169



SYMPTOMS
If you create a compiled Visual Basic OCX that contains a Property Page and that Property Page has code that calls to an OLE DLL server, the Property Page may not close as expected.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



MORE INFORMATION
Below are the steps to reproduce this behavior. These steps are broken into three segments, including the creation of the DLL Server, the creation of the OCX, and testing the OCX.

Part 1 - Create the DLL Server
 Create a new ActiveX DLL Project. Class1 is created by default. From the Project menu, select Properties, and set the Project Name to "DLLSVR."  Paste the following code into Class1: Public Sub ShowIt Dim MyForm As Form1

' Create new instance of the form Set MyForm = New Form1

' Show the form as modal MyForm.Show vbModal

' Unload the form Unload MyForm

' Clear out form reference Set MyForm = Nothing End Sub

 Add a Form to the project. Compile the DLL. Save the project.</li></ol>

Part 2 - Create the Custom Control
<ol> Create a new ActiveX Control Project. UserControl1 is created by default. NOTE: Do not keep the DLL project from Part I loaded.</li> Select References from the Project menu, and add a reference to the previously created DLL, "DLLSVR."</li> Select Add Property Page from the Project menu, and add a Property Page.</li> Add a CommandButton to the property page.</li>  Paste the following code into the Property Page's code window: Private Sub Command1_Click Dim MyClass As DLLSVR.Class1

' Create instance of the class Set MyClass = New DLLSVR.Class1

' Call method of the class MyClass.ShowIt

' Get rid of class reference Set MyClass = Nothing End Sub

</li> Set the PropertyPages property of the UserControl to PropertyPage1.</li> Compile the OCX.</li> Save the project.</li></ol>

Part 3 - Testing the Control

 * 1) Select Add Project from the File menu, and add a Standard EXE project, leaving the Custom Control Project from part 2 still loaded. Form1 is created by default.
 * 2) Add an instance of the custom control to Form1.
 * 3) Alternate-mouse click on the control and select "Properties."
 * 4) Click the CommandButton on the Property Page.
 * 5) Close the window that was shown.
 * 6) Try to close the Property Page. Note that the Property Page doesn't go away. Clicking directly on the underlying form will cause the Property Page to be removed from the screen.

Additional query words: kbDSupport kbDSD kbVBp kbVBp500bug kbPropSheet

Keywords: kbbug kbfix KB192169

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.