Microsoft KB Archive/40155

From BetaArchive Wiki
Knowledge Base

QB.EXE 4.50 Bad Alert Box if User TYPE "Element Not Defined"

Article ID: 40155

Article Last Modified on 11/21/2006

This article was previously published under Q40155


In QuickBasic Version 4.50, if you attempt to run a program that contains erroneous use of user-defined typed variables (specifically, an "element not defined" error), QuickBasic may bring up an alert box that contains irrelevant information, and possibly garbage.

This problem occurs only in Microsoft QuickBasic Version 4.50 for MS-DOS. Microsoft is researching this problem and will post new information as it becomes available.

This problem is not an issue if you always make sure to define all elements of a user-defined TYPE before using them.


Microsoft has confirmed this to be a bug in Version 4.50. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Consider the following program:

DIM Var AS Test

To reproduce the problem, do the following:

  1. Run this program as is. You should get a "Type mismatch" error message on the PRINT statement.
  2. Change the PRINT statement line to print out an element of Var that does not exist (for example, PRINT Var.z).

Attempting to run the modified version of the program will produce an alert box that contains completely random, irrelevant information, often incomplete sentences, sometimes single words or characters, and, occasionally, incomprehensible garbage.

If the program is run again without changing it, the same information will appear in the alert box. However, if the PRINT statement is changed again (i.e., to another element that does not exist), a new alert box is produced, with different, meaningless information. If this is repeated several times (making a change, running the program, making a change, running the program, etc., about 30 times), the alert box itself may be garbled or incomplete and the machine eventually will hang.

However, if a change is made to the DIM statement line (even a noncritical edit, such as inserting a line before the DIM statement), you will get the correct "Element not defined" error when you run the program. The problem will not recur from this point on, until you change the PRINT statement back to just PRINT Var, and run to get the "Type Mismatch" error message.

Additional query words: QuickBas buglist4.50

Keywords: KB40155