Microsoft KB Archive/47510

= Watch Value and Watchpoint Ignored During Event or ERROR Trap =

Article ID: 47510

Article Last Modified on 11/21/2006



This article was previously published under Q47510



SUMMARY
When using ON ERROR GOTO or any of the ON event GOSUB statements (where event includes KEY, TIMER, COM, PEN, PLAY, and STRIG), watchpoints or watch values will not function while you are in the ON ERROR GOTO or ON GOSUB subroutine. Watch values will show the default value for the type of variable (either 0 or a null string), and watchpoints will not halt the program.

This behavior occurs in the QB.EXE editor for QuickBasic Versions 4.00, 4.00b, 4.50 and the QB.EXE editor for Microsoft Basic Compiler Versions 6.00 and 6.00b. This behavior is a known design limitation of these versions of QuickBasic and is not an error.

The QBX.EXE editor for Microsoft Basic PDS 7.00 has been enhanced so that you may now use watchpoints and watch values in ON ERROR GOTO and ON GOSUB subroutines.



MORE INFORMATION
The following example demonstrates the limitation: ON TIMER (5) GOSUB 1000 TIMER ON WHILE INKEY$ = &quot;&quot; : WEND END

1000 PRINT &quot;In routine&quot; FOR x = 1 TO 10 PRINT x    NEXT x     RETURN Execute the program with a watchpoint or watch value for the variable &quot;x&quot;. The watchpoint will not halt the program in the FOR NEXT loop as you would expect. If you set a breakpoint inside the FOR NEXT loop, you will also see that a watch value on &quot;x&quot; will always report a value of 0.

Additional query words: QuickBas BasicCom

Keywords: KB47510

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.