"SELECT Without END SELECT" Flagged in Wrong Place by QB 4.00 (49130)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q49130

SYMPTOMS

The QB.EXE editor in QuickBasic Versions 4.00, 4.00b, and 4.50 flags the error "SELECT without END SELECT." However, the editor does not correctly locate and highlight the area of the code where the error occurs. The editor incorrectly places the cursor (or highlighting) at the top right corner or "home" of the current window, even though the error may have occurred several pages down.

STATUS

Microsoft has confirmed this to be a bug in QB.EXE in QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS. This problem was corrected in the QBX.EXE environment supplied with Microsoft Basic Professional Development System (PDS) Version 7.00 for MS-DOS and MS OS/2 (fixlist7.00).

MORE INFORMATION

Whenever a mismatch occurs with two paired statements, the editor should highlight the other member of the pair when it reports an error message. For example, if a program contains a multiple-line IF statement but fails to include the END IF statement, the editor should locate the error, highlight the IF keyword, and then display the error message in a dialog box. However, for the error "SELECT without END SELECT," the editor incorrectly fails to highlight the SELECT statement that is missing a matching END SELECT phrase.

Code Example

The following code example demonstrates the problem:
REM <-- The QB.EXE editor misleadingly highlights this topmost REM
REM     statement when the "SELECT without END SELECT" error
REM     occurs, no matter where the SELECT error is located in
REM     this window.
SELECT CASE x%
CASE 1
CASE 2
   ' END SELECT  ' Adding this END SELECT corrects the syntax error.
				
The error-flagging location problem does not occur for IF statements, as in the following example:
REM  QB.EXE correctly highlights "IF" for the following
REM  "Block IF Without END IF" error:
IF x% THEN
   PRINT "hello"
      ' END IF ' Adding this END IF corrects the syntax error.
				

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