Value of Variables Reset in Immediate PaneLast reviewed: July 29, 1997Article ID: Q111668 |
The information in this article applies to:
SUMMARYIn a Visual Basic module, when you bring up the Debug window in the middle of a procedure and dimension a variable in the Immediate pane as a user- defined type, if you return the value of any variable defined in the procedure by typing the variable name in the Immediate pane, you receive the following error message:
User-defined type not definedNote that the values of the variables are reset only when you return the value in the Immediate pane. The values are still available when you continue running the procedure.
MORE INFORMATIONUsually, when you define a variable using the Dim statement in a procedure, the defined value exists until the procedure is finished running. You can use the Immediate pane in the Debug window while a procedure is running to return the current value of a variable by typing the following statement in the Immediate pane and pressing ENTER:
?<varname>where <varname> is the name of the variable. To bring up the Debug window while a procedure is running, you can use the Stop statement or set a Breakpoint in your procedure. A user-defined data type is any data type that you define using the Type statement. A user-defined data type can contain one or more variables of different types. As an example, to define the user-defined data type PHONE containing the variable AREA of Integer data type, use the following syntax at the top of your module:
Type Phone Area as Integer End TypeThe following is an example of a statement that declares the variable X as the user-defined data type PHONE:
Dim X as PhoneIf you type this statement in the Immediate pane, you receive the following error message:
Invalid in Immediate paneAdditionally, if a procedure is running when you type this statement in the Immediate pane, you cannot return the value of any variable defined in your procedure by typing the name of the variable in the Immediate pane. You must run the procedure again to return the correct value of your variable by typing it in the Immediate pane.
REFERENCESFor more information about user-defined data types or a data type summary, choose the Search button in the Visual Basic Reference and type:
user-defined typeFor more information about the Type statement, choose the Search button in the Visual Basic Reference and type:
type Keywords : kberrmsg kbprg Version : 1.00 Platform : WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |