Cannot Modify a Visual Basic Procedure in Break Mode

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 :
Version : :1.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 22, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.