DOCUMENT:Q246919 28-JUL-2001 [vbwin] TITLE :FIX: VB Crashes on ActiveX Control Interface Wizard Code PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:6.0 OPER/SYS: KEYWORDS:kbAddIn kbCtrl kbDatabase kbDataBinding kbDesigner kbVBp600bug kbGrpDSVBDB kbDSupport k ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Enterprise Edition for Windows, version 6.0 ------------------------------------------------------------------------------- SYMPTOMS ======== Visual Basic crashes when running a Standard EXE project that contains an ADO Data Control and a UserControl that has DataGrid or MSHFlexGrid controls if the UserControl code was generated by the ActiveX Control Interface Wizard. The crash occurs on the call to the ReadProperty() method of the PropertyBag object in the UserControl's ReadProperties event: Private Sub UserControl_ReadProperties(PropBag As PropertyBag) 'Crashes on the following line: Set DataSource = PropBag.ReadProperty("DataSource", Nothing) End Sub STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0. For additional information about Visual Studio service packs, click the article numbers below to view the articles in the Microsoft Knowledge Base: Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why Q194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed You can download the latest Visual Studio service pack from the following Microsoft Web site: Visual Studio Product Updates (http://msdn.microsoft.com/vstudio/downloads/updates.asp) MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. In Visual Basic, create a new ActiveX Control project. Project1 is created by default. UserControl1 is added to Project1 by default. 2. From the Project menu, click to select References. From the list of available References, click to select Microsoft Data Source Interfaces. 3. From the Project menu, click to select Components. From the list of available Components, select Microsoft DataGrid Control 6.0 (OLE DB). 4. Add a DataGrid control to UserControl1's Design window. DataGrid1 is added by default. 5. If the ActiveX Control Interface Wizard is not listed on the Add-Ins menu, do the following: a. From the Add-Ins menu, select Add-In Manager. b. From the list of available Add-Ins, select VB6 ActiveX Ctrl Interface Wizard. c. Check the Loaded/Unloaded checkbox, and then click OK. 6. From the Add-Ins menu, click to select ActiveX Control Interface Wizard. a. At the Introduction screen (if displayed), click Next. b. At the Select Interface Member dialog box: 1. Move all pre-selected properties to the list box on the left. 2. Move only the DataSource property to the right, so that it is the only Property listed in Selected names. 3. Click Next. c. At the Create Custom Interface Members screen, click Next. d. In the Maps To section of the Set Mapping screen: 1. Select DataGrid1 from the Control drop-down list. 2. Select DataSource from the Member drop-down list. 3. Click Next. e. In the Finished! screen, deselect View Summary Report, and then click Finish. 7. Save and compile the UserControl. Close the UserControl1 Design window. 8. From the File menu, select Add Project to add a Standard EXE project. Project2 is created by default. Form1 is added to Project2 by default. 9. From the Project menu, click to select Components. From the list of available Components, select Microsoft ADO Data Control 6.0 (OLE DB). 10. Place an ADO Data Control onto Form1. ADODC1 is created by default. a. Set the ConnectionString property of the ADO Data Control to connect to the Nwind database that comes with Visual Basic. Connect by using either ODBC or the Jet OLE DB Provider. b. Set the RecordSource property of the ADO Data Control to the Customers Table. 11. Place an instance of the UserControl onto Form1. UserControl1 is created by default. Set the DataSource property of UserControl1 to ADODC1, the ADO Data Control. 12. In the Project Group in Project Explorer, set Project2 as the Start Up Project. 13. Press function key F8 to Step Into the Project2's code, and note that Visual Basic crashes under the UserControl1_ReadProperties event: Private Sub UserControl_ReadProperties(PropBag As PropertyBag) 'Crashes on the following line: Set DataSource = PropBag.ReadProperty("DataSource", Nothing) End Sub (c) Microsoft Corporation 2000, All Rights Reserved. Contributions by Adrian C. Bradley, Microsoft Corporation (c) Microsoft Corporation 2000, All Rights Reserved. Contributions by John Hamrick, Microsoft Corporation Additional query words: sp4 ====================================================================== Keywords : kbAddIn kbCtrl kbDatabase kbDataBinding kbDesigner kbVBp600bug kbGrpDSVBDB kbDSupport kbVS600sp4fix kbVS600sp5fix Technology : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB600Search kbVB600 Version : WINDOWS:6.0 Issue type : kbbug Solution Type : kbfix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.