Microsoft KB Archive/41394

= Microsoft Knowledge Base =

Saving Source with Error in SUB Statement Reloads Incorrectly
Last reviewed: January 12, 1995

Article ID: Q41394

SUMMARY
In the QB.EXE environment of QuickBasic Version 4.00, 4.00b, or 4.50, Microsoft Basic Compiler Version 6.00 or 6.00b, or in the QBX.EXE environment of Microsoft Basic PDS Version 7.00, saving a module in which a SUB or FUNCTION statement contains a syntactically incorrect parameter list may cause QuickBasic to fail to reload the same program into separate windows. A SUBprogram or FUNCTION that was initially displayed in its own window is now displayed (incorrectly) in the window containing the module-level code.

If the error in the SUB or FUNCTION parameter list is now corrected, and the cursor is moved to another line of code (using an ARROW key, the ENTER key, or a mouse), the SUB or FUNCTION statement is correctly displayed in its own window. However, any code that was contained within the SUBprogram or FUNCTION remains with the module-level code, including a copy of the END SUB or END FUNCTION statement. That code must be manually moved (using Cut and Paste) from the module-level code to the SUBprogram or FUNCTION.

To prevent this problem, always correct any problems that have been noted by the QB.EXE or QBX.EXE environment BEFORE saving the file to disk.

This information applies to the QB.EXE environment that comes with QuickBasic Versions 4.00, 4.00b, and 4.50 and Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and to the QBX.EXE environment that comes with Microsoft Basic PDS Version 7.00 for MS-DOS. This behavior is a design limitation of these environments.