The Locals window displays the class member variables and their values for each method in the current stack frame. As the execution switches from method to method, the contents of the Locals window changes to reflect the local variables applicable to the current method.
The Locals window contains fields for the Name, Value, and Type for each member variable. The value of a given variable will be displayed after it has been declared in your program. If a variable is not in scope when you display the Locals window, a message appears in the Value field next to the variable’s name. You will need to step through more code before you’ll see values for these variables. The Locals window is updated only when execution is suspended. Values that have changed since the last suspension are displayed in red.
To display the Locals window
– or –
Press the key combination, CTRL+ALT+L.
– or –
Click the Locals button on the Debug toolbar.
To change class information in the Locals window
Note When you’ve defined more than one class for your program, you may want to see values for variables in all these classes. The Locals window always displays the member variables for the class that contains your program’s entry point (main()
or init()
). Once you’ve either stepped into or stopped on a breakpoint in a different class, use the drop-down list box at the top of the Locals window to select this class and view its member variables.
To copy a variable from the Locals window to another window
To change the value of a variable
To view or hide class member variables and array elements
See Navigation Keyboard Shortcuts for the Auto, Locals, and Watch Windows for additional information on how to move around in these windows and expand, and collapse class member variables and array elements.
See Viewing Local Variables in the Locals Window for more information about the Locals debug window.