Microsoft KB Archive/316170

= BUG: Upgrade Wizard incorrectly converts an ActiveX control's DataSource property when you upgrade a project from Visual Basic 6.0 to Visual Basic 2005 or to Visual Basic .NET =

Article ID: 316170

Article Last Modified on 12/6/2006

-

APPLIES TO


 * Microsoft Visual Basic 2005
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-



This article was previously published under Q316170



SYMPTOMS
When you use the Upgrade Wizard to upgrade a project from Microsoft Visual Basic 6.0 to Microsoft Visual Basic 2005 or to Microsoft Visual Basic .NET, the DataSource property of the ActiveX controls contained in the upgraded project may not migrate correctly. If the fully qualified name is used to access the DataSource property, the DefInstance property is not added during migration.

For example, the following line of code appears in your Visual Basic 6.0 project. Set Form1.DataGrid1.DataSource = Form1.Adodc1 After the upgrade to Visual Studio 2005 or to Visual Studio .NET, this line appears as follows. 'UPGRADE_ISSUE: VBControlExtender property DataGrid1.DataSource is not supported at runtime. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword=&quot;vbup2066&quot; Set Form1.DataGrid1.DataSource = Form1.DefInstance.Adodc1 The &quot;Form1.DataGrid1&quot; element is underlined by the blue, wiggly line that is used for error alerts.

Note If you replace &quot;DataGrid1&quot; with any Visual Basic 6.0 ActiveX control that supports the DataSource property, this should still throw the same error.



CAUSE
This behavior occurs because the Upgrade Wizard does not properly handle the DataSource property of the ActiveX controls that support this property.



RESOLUTION
To resolve this issue, manually add DefInstance between the form name and the ActiveX control name: Specifically, change Form1.DataGrid1 to Form1.DefInstance.DataGrid1.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
Note The Visual Basic 2005 or Visual Basic .NET Upgrade Wizard is included with Visual Studio 2005 and with Visual Studio .NET Professional Edition.

Steps to reproduce the problem
 Start Visual Basic 6.0, and then open a new Standard EXE project.

Form1 is added by default. Add a .bas module to the project. Add the Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft DataGrid Control 6.0 (OLEDB) controls to Form1.  Add the following code to the .bas module. Sub Main Form1.Show Set Form1.DataGrid1.DataSource = Form1.Adodc1 End Sub Make sure that the names of the objects in this code match the name of the objects that you placed on the form in step 3.  Make Sub Main the startup object for the project.</li> Save the project, and then quit Visual Basic 6.0.</li> Start Visual Studio 2005 or Visual Studio .NET, and then open the project that you saved in step 6.

This starts the Upgrade Wizard.</li> Navigate through the Upgrade Wizard and accept all of the defaults.</li>  After the Upgrade Wizard is finished upgrading the project, open the module.

The code will now look like the following. Public Sub Main Form1.DefInstance.Show 'UPGRADE_ISSUE: VBControlExtender property DataGrid1.DataSource is not supported at runtime. Click for more: ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword=&quot;vbup2066&quot; Form1.DataGrid1.DataSource = Form1.DefInstance.Adodc1 End Sub &quot;Form1.DataGrid1&quot; is underlined by the blue, wiggly error line. </li></ol>

Additional query words: Migration Wizard ActiveX DataGrid MSChart DataList MeskEdBox

Keywords: kbvs2005applies kbvs2005swept kbvs2002sp1sweep kbmigrate kbbug KB316170

-

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

© Microsoft Corporation. All rights reserved.