Microsoft KB Archive/43791

From BetaArchive Wiki
Knowledge Base

Article ID: 43791

Article Last Modified on 11/21/2006

This article was previously published under Q43791


Using an $INCLUDE file containing DATA statements that are (illegally) located inside a SUB or a FUNCTION can cause the QB.EXE editor to hang. This problem occurs when you attempt to View Subs, Save, or Run the program. The problem also occurs when you use the Merge command (from the File menu) to merge a file that contains DATA statements into a SUB or FUNCTION block.

Note that DATA statements are not legal inside SUB ... END SUB or FUNCTION ... END FUNCTION blocks.


Microsoft has confirmed this to be a bug in Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50. This problem was corrected in Microsoft Basic Professional Development System (PDS) Version 7.00 (fixlist7.00).

In the QBX.EXE editor that comes with PDS, this problem is caught by the error message "Illegal in SUB, FUNCTION, or DEF FN."

This problem can be worked around by observing the rule that DATA statements cannot be placed (or included) inside SUBs or FUNCTIONs.


On one occasion, trying to change SUBs in the described case caused the message "String Space Corrupt" to be displayed and control was transferred to MS-DOS.

If the program is edited in a different editor and then taken into the QB.EXE editor, the INCLUDEd DATA statements are placed on the module level. The program then runs correctly. If this version is then saved, the DATA statements will be duplicated the next time this program is edited.

Code Example

Entering the following program example while in the QB editor illustrates the problem:

    CALL test

   SUB test

This example assumes that you have previously created DATA.INC to contain the following:

DATA 1,2,3

Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom

Keywords: KB43791