Microsoft KB Archive/180528

{|
 * width="100%"|

FIX: Sub Main Does Not Transfer Control to Form

 * }

Q180528

-

The information in this article applies to:


 * Microsoft Windows CE Toolkit for Visual Basic 5.0, version 1.0

-

SYMPTOMS
When a Windows CE project has a module with Sub Main set as the Startup Object, control of the application does not transfer to a form when the Sub Main is finished, causing the application to end prematurely.

RESOLUTION
Avoid using Sub Main as the Startup object. Use a form as the Startup object.

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

This problem was corrected in Window CE Toolkit for Visual Basic 6.0.

Steps to Reproduce Behavior
 Create a new Windows CE Project in Visual Basic 5.0. Form1 is created by default. Add a new module to the project by selecting Add Module from the Project menu.  Add the following code to Module1:      Sub Main Form1.Show End Sub  Select Project1 Properties from the Project menu. Set the Startup Object to Sub Main. Press the F5 key to run the project and note that the application will end when sub main execution is completed instead of passing control of the application to Form1.

© Microsoft Corporation 1999, All Rights Reserved.

Contributions by Mike Dixon, Microsoft Corporation

Additional query words: wince vbce vbce5 vbce6

Keywords : kbToolkit kbVBp kbVBp500bug kbVBp600fix kbOSWinCEsearch kbOSWinCE100 kbGrpDSVB

Issue type : kbbug

Technology : kbVBSearch kbAudDeveloper kbWinCETKVBSearch kbWinCESearch kbWinCETK100VB500