BUG: Property Page Does Not Close Using Compiled VB OCX
ID: Q192169
|
The information in this article applies to:
-
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0
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.
Part 2 - Create the Custom Control
- Create a new ActiveX Control Project. UserControl1 is created by
default. NOTE: Do not keep the DLL project from Part I loaded.
- Select References from the Project menu, and add a reference to the
previously created DLL, "DLLSVR."
- Select Add Property Page from the Project menu, and add a Property Page.
- Add a CommandButton to the property page.
- 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
- Set the PropertyPages property of the UserControl to PropertyPage1.
- Compile the OCX.
- Save the project.
Part 3 - Testing the Control
- 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.
- Add an instance of the custom control to Form1.
- Alternate-mouse click on the control and select "Properties."
- Click the CommandButton on the Property Page.
- Close the window that was shown.
- 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 : kbGrpVB
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbbug