I am wondering on what concept/logic the ordering of the variables is based on in the 'Locals' tab when debugging an application with MS Visual Studio. For me it seems to be somewhat randomly ordered? Or is there any concept behind the ordering of these variables?
Is there an option to sort these variables alphabetically? This would be very handy.
Locals While debugging you can enable 'Locals' which will show you all variables in the current stack frame. Go to menu Debug->Windows->Locals to make it appear. Watch Although it is a little manually you also can use 'Watch' you can drag and drop any variable to this window or right click then add to watch.
Hover over a variable to see its value. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.
To open the Locals window, while debugging, select Debug > Windows > Locals, or press Alt+4. This topic applies to Visual Studio on Windows.
In my Visual Studio 2008, the sort order of Locals window is as follows: the current class-level Me
object is first, with any module-level variables being sub-nodes of that. Then listed below Me
are the procedure-level variables in Alphabetical order. After years of searching, I haven't found any way to change the sort order. The only thing left I can think of is a Visual Studio Extensibility Add-In, but I haven't explored that.
I have a strong background in VBA, and I can tell you over there, if there's a Me
object in the current context, that comes first just like Visual Studio. But...and here's the difference...the module-level variables are listed in Declaration Order, meaning they're listed in the same order as their Dim
statements. And just like Visual Studio, the order can't be changed.
The VBA way of doing it is much more useful, because you can control the order of the Locals window by re-ordering the Dim
statements in the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With