Search code examples
vb6immediate-window

Can you perform an iteration in the VB6 immediate window?


While debugging a VB6 program it would be useful to output a fairly large multidimensional array in the immediate window. That would enable copy/paste to another editor for analysis and would be easier than clicking through the array in the locals window.

However I'm unsure of how to use looping syntax in the immediate window - or even if this is possible.


Solution

  • You can use the colon (:) to separate statements on a single line. For instance:

    for x=0 to 2:for y=0 to 2: ? myData(x,y): next : next
    

    Result:

    This is 0 0
    This is 0 1
    This is 0 2
    This is 1 0
    This is 1 1
    This is 1 2
    This is 2 0
    This is 2 1
    This is 2 2