How to Update Include Files in QB.EXE/QBX.EXE Editor (79379)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 7.1

This article was previously published under Q79379

SUMMARY

The QB.EXE or QBX.EXE environment may not recognize changes made to an include file currently in use (via the REM $INCLUDE metacommand) unless the file is loaded as an include file. If the include file is loaded as a module, modified, and saved, QB.EXE or QBX.EXE may not recognize the changes made.

To load an include file so that QB.EXE or QBX.EXE will recognize changes, use the Load File command from the File menu, and specify that the file is an include file. If you correctly load the file as an include file, make changes to the file, save the file, and restart your program, then the changes will be recognized.

MORE INFORMATION

Include files provide a convenient way to keep DECLARE, COMMON, and TYPE statements consistent in multiple modules of a program. During the development of the program, though, these include files will occasionally need to be modified.

A common oversight is to load the include file in the same way as you would a module of your program (by choosing the Load File command from the File menu) without changing the Load As option. Because the default on this option is to Load As Module, the include file is treated as a module. If you make changes to the file, save it, and try to run the program, you will find that the new changes have not been recognized by the program using the include.

The reason for this is that when QB.EXE or QBX.EXE encounters an INCLUDE statement, it loads the code from that file into memory. Therefore, even when you have changed the include file (after loading it as a module), QB.EXE still uses the copy of the file that is in memory.

You can force QB.EXE or QBX.EXE to update the changed include file as described in either of the two sections below.

How to Update Include File when Loaded as an Include File

To load and edit the file as an include file, do the following:

  • From the File menu, choose Load File. Change the Load As option to Include, then select the desired file as you normally would. -or-

  • With the cursor on the REM $INCLUDE: statement, choose Include File from the View menu.
Once the file is loaded as an include file, it can be edited normally. If you don't save the changes made to the file before you attempt to run the program, QB.EXE/QBX.EXE displays the following message:
Modified INCLUDE files must be saved before running. Save them now?
When you acknowledge the message, QB.EXE/QBX.EXE updates the include files that are in memory, and the changes take affect in the run of the program.

How to Update Include File When Loaded as a Module

To force QB.EXE/QBX.EXE to update an include file that has been mistakenly loaded as a module, do the following:

  1. Save the include file.
  2. Place the cursor on the REM $INCLUDE statement and make some edit movement, such as by pressing SPACEBAR then BACKSPACE.
  3. When you move the cursor off of the REM $INCLUDE line, QB.EXE/QBX.EXE parses the line and loads the new include file. Note that if this method is used, it must be done at every REM $INCLUDE line that mentions the changed file.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB79379