Cannot Modify a Visual Basic Procedure in Break Mode

Last reviewed: July 29, 1997
Article ID: Q116392
The information in this article applies to:
  • Microsoft Visual Basic Programming System, Applications Edition, version 1.0

SYMPTOMS

In a Microsoft Visual Basic Programming System, Applications Edition procedure, you cannot modify or skip a line of code in the procedure either while you are stepping through the procedure, or after you have reached a breakpoint in the procedure.

CAUSE

This behavior is caused by the way that Visual Basic modules are compiled. You cannot edit a Visual Basic procedure while in break mode.

When you use the Step Into button to step through a procedure, or when a breakpoint has been reached in the procedure, the module appears in the Debug window. If you then attempt to modify a procedure in the module, you receive the following error message:

   You'll have to restart your program after this edit - proceed anyway?

If you choose Yes, the procedure stops running, and you can edit your code. If you choose No, you can continue running the procedure.

MORE INFORMATION

A Visual Basic module is compiled, or translated into code that can run, the first time you run a procedure in the module. Additionally, any module that this module depends on is also compiled. For example, if a procedure or variable is used in another module, that module is also compiled. Also, any dependent module in a dependent project is compiled, and the dependent project is loaded at this time (if it isn't already loaded).

There are several stages of compilation. During the first stage, each line of code in the module is parsed as you enter the line. The next stage occurs when you run a procedure in the module. All the module-level code (that is, variables, types, and declaration statements [sub, function, and property]) is compiled. (All modules in all projects involved must get to this stage before any module can be compiled further. You can receive a compile error in a non-dependent module when a different module is being compiled.) After this stage, all lines in all procedures in the dependent modules, and only the dependent modules this time, are fully compiled and the specified procedure runs.


Additional query words: err msg
Keywords : kberrmsg kbprg kbusage
Version : 1.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.