Microsoft KB Archive/191691

= BUG: Sub Moved Above Enum or Type Causes Incompatibility Error =

Article ID: 191691

Article Last Modified on 5/13/2003

-

APPLIES TO


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

-



This article was previously published under Q191691



SYMPTOMS
If you move a procedure to the beginning of a class module above a Enum or Type statement and then recompile the project with Binary Compatibility set, a version incompatibility error similar to the following occurs where "Test" is the name of an Enum:

"Enum "Test" exists in the version-compatible component, but not in the current project"



RESOLUTION
If the procedure is placed below the Enum and Type Statements, the project recompiles with no compatibility error.



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



Steps to Reproduce Behavior
 Create a new ActiveX DLL project in Visual Basic. Class1 is created by default.  Paste the following code into Class1: Public Type Type1 i As Integer End Type

Public Enum Test Red Yellow Green End Enum

Public Sub Test3 End Sub

 In the Property window of Class1, set Instancing to GlobalMultiuse. Compile Project1.Dll by selecting Make Project1.Dll from the File menu. From the Project Menu, select Project1 Properties, click the Component tab, and then check Binary Compatibility. In Class1, move the section of Sub Test3 to be above Enum Test.</li> Re-Compile the project as "Project2.dll" by selecting Make Project1.dll from the File menu. Change the filename to Project2. Note that the following error occurs:

"Enum "Test" exists in the version-compatible component, but not in the current project"

If you move Sub Test3 back to its original position and recompile as Project2.dll, then it compiles successfully.</li></ol>

Additional query words: kbDSupport kbVBp600bug kbCompiler kbdss kbVBp

Keywords: kbbug kbpending KB191691

-

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

© Microsoft Corporation. All rights reserved.