Microsoft KB Archive/191693

= BUG: Ambiguous Name Detection for Private Functions Named "Main" =

Article ID: 191693

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 Q191693



SYMPTOMS
When a Visual Basic project contains two or more functions named "Main" (but only one is Public) and Sub Main is set as the Startup Object, the following error is received when the Project is compiled or run:

"Ambiguous name detected: main"



CAUSE
In addition to Public functions, Visual Basic also searches for Private functions for any name conflict.



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 Standard EXE project in Visual Basic. Form1 is created by default. Select Project Properties from the Project menu. Change the Startup Object to Sub Main. Add two code modules to the Project by choosing Add Module from the Project menu twice.  Paste the following code in the code window of Module1: Public Sub Main Msgbox "Hello" End Sub   Paste the following code in the code window of Module2: Private Sub Main Msgbox "Hi" End Sub </li> Press the F5 key to run the project. Note that the following error message is received:

"Ambiguous name detected: main"

</li></ol>

Additional query words: kbDSupport kbVBp600bug kbCompiler kbdss kbVBp

Keywords: kbbug kbpending KB191693

-

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

© Microsoft Corporation. All rights reserved.