View Variables in Other Scopes




See also


The Watches window is most useful for native code (C, C++, VB) where it can be used to evaluate data items that are not available as Local Variables - data items with module or file scope and static Class member items

You can also use the window to evaluate static Class member items in Java and .NET

To use the Watches window, type the name of the variable to examine in the field in the window toolbar, and either press ( Enter )  or click on the Add new watched item icon

To examine a static Class member variable in C++, Java or Microsoft .NET, enter its fully qualified name; for example:


To examine a C++ data symbol with module or file scope, just enter its name

Variables are evaluated by looking at the current scope; that is, the module of the current stack frame (you can change the scope at a breakpoint by double-clicking the frame in the call stack)

If the global variable exists in a different module, you can examine the variable by prefixing the module name to the variable; for example:


The names of the items to evaluate persist for the package and user ID, so the next time you debug the same project, the items evaluate automatically whenever a breakpoint occurs; they do not appear if another user debugs the same code

If necessary, you can delete items using the Delete all watched items icon in the toolbar, or the right-click context menu option inside the window

View the Local Variables

Learning Center topics:

  • (Alt+F1) | Build and Debug | Debug | View Global Variable