BUG: The Visual Basic .NET or Visual Basic 2005 Upgrade Wizard reports an incorrect warning message for user-defined data types

This article has been archived. It is offered "as is" and will no longer be updated.
If you use Visual Basic Upgrade Wizard on your Microsoft Visual Basic 6.0 project with a user-defined data type, the wizard generates a warning message for the code with user-defined data type assignments. For example, you may receive the following warning message for a direct user-defined data type assignment.
UPGRADE_WARNING: Could not resolve default property of object <<UDT>>. Click for more information: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037'
The wizard incorrectly treats the user-defined data type variables as a class object, and then tries to locate the default property for the object. The user-defined data type does not have default properties. Therefore, the wizard cannot locate a default property, and it reports an incorrect warning.
You can directly assign one user-defined data type to another, or you can make a member wise copy between the user-defined data type variables. You receive the warning messages only if you create a direct user-defined data type assignment between the variables.

You can safely ignore these warning messages in Visual Basic .NET or Visual Basic 2005 code. However, instead of using a direct assignment, you can perform a member wise deep copy between user-defined data type variables to suppress the warning messages.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Steps To Reproduce the Behavior

  1. Open Visual Basic 6.0.
  2. On the File menu, click New Project.
  3. Under New Project, select Standard Exe, and then click OK.

    By default, Form1 is created.
  4. In Project Explorer, right-click Form1 and then click Remove Form1.
  5. On the Project menu, click Add Module, and then click Open.
  6. Add the following code to Module1:
    Option Explicit' Create a User-Defined Data TypePublic Type myType    x As Integer    y As IntegerEnd TypePublic Sub main()    Dim a As myType    Dim b As myType    b.x = 500    b.y = 250    a = b		' Direct UDT assignment    Debug.Print (a.x)    Debug.Print (a.y)End Sub
  7. On the File menu, click Save Project to save the module as Module1.bas, and to save the project as Project1.vbp.
  8. Open Visual Studio .NET or Visual Studio 2005.
  9. Click File, point to Open, and then click Project.
  10. Locate and then click Project1.vbp.

    Visual Basic Upgrade Wizard starts automatically.
  11. Click Next to upgrade the Visual Basic 6.0 code.
  12. In Solution Explorer, double-click Module1.vb.

    The wizard incorrectly generates the following warning message code:
    Option Strict OffOption Explicit OnModule Module1	' Create a User-Defined Data Type	Public Structure myType		Dim x As Short		Dim y As Short	End Structure		Public Sub main()		Dim a As myType		Dim b As myType		b.x = 500		b.y = 250		'UPGRADE_WARNING: Couldn't resolve default property of object a. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'		a = b		' Direct UDT assignment		System.Diagnostics.Debug.WriteLine(a.x)		System.Diagnostics.Debug.WriteLine(a.y)	End SubEnd Module
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
317885 How to use the Visual Basic Upgrade Wizard

Article ID: 814601 - Last Review: 02/27/2014 21:17:08 - Revision: 2.3

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

  • kbnosurvey kbarchive kbvs2005swept kbvs2005applies kbvs2002sp1sweep kbbug kbmigration kbconversion kbconvert KB814601