Using the Locals Window

The Locals Window can be used to see a list of all the objects and variables that are used in the current procedure. The values in the list are updated every time you suspend execution with a breakpoint or step through code.

Try It Out Using the Locals Window

Now, let's walk through an example of using the Locals Window.

1. Display the Locals Window by selecting View C> Locals Window.

2. Run the TestLoop procedure again from the Immediate Window.

3. The code execution will again stop when the first breakpoint is reached. Notice that the values in the Locals Window are updated with the current value of intCounter.

| (General)

w

TestLoop

3]

■increment intCounter from 1 to 5 and 1 display output in debug window For intCounter = 1 To 5

| Debug.

Print intCouistei

©

End Sub

Locals

d'

Ch2JCodeExamples. nnodBusinessLogic.TestLoop

Expression Value Typs ^

□ modBusinessLngit T— stnest intCounter 1

nno d B u s iness Lo g ic/im

String Integer

T

li

■<l 1

Figure 2.36

4. Press F5 or select Run C> Continue to keep executing the lines of code. You should see that the values of intCounter in the Locals window change as you walk through the code.

0 0

Post a comment