Click here to Skip to main content
15,890,388 members
Articles / General Programming / Debugging
Tip/Trick

Pinning the variables/expressions while debugging

Rate me:
Please Sign up or sign in to vote.
3.00/5 (2 votes)
1 May 2010CPOL1 min read 10.6K   1  
This feature may not seem useful initially, and might appear distracting you. But it is one of the very useful (new) features in Visual Studio 2010. You'll love it after using it for a while!While debugging, you typically put some variables in Watch Window (or use Locals, Autos etc). When...
This feature may not seem useful initially, and might appear distracting you. But it is one of the very useful (new) features in Visual Studio 2010. You'll love it after using it for a while!

While debugging, you typically put some variables in Watch Window (or use Locals, Autos etc). When you keep adding expressions/variables in Watch window, this list goes large and becomes clumsy, unreadable.

With DataTips, you can place variables or expressions as a floating content. It would appear the same way when you hover mouse over a variable - as a tooltip. But when you move mouse away from variable, the tooltip goes away.

When you add the expression using DataTips, it would remain there. You can also move it anywhere - just like any window.

How to pin?

Just hover over a variable, or select the variable/expression. Then click the pinning button on right of tooltip. The DataTip is added!
The DataTip may be:
  • Pinned to Source
  • Unpinned from source
If Pinned to Source, the DataTip would appear only if code (program) goes to relevant function/block. It will not appear otherwise.

The DataTip would always appear, if not pinned to source.

To Pin to Source, just click on variable/expression, right click and select 'Pin to Source'.

I cannot quite understand (as of now), how VS selects Source-pinning/unpinning of we add it by hovering and adding. Sometimes it Pins to source, sometime it doesnt.

But in both approaches, the DataTip appears as floating content. You can change the source-pinning behavior by clicking the middle of the DataTip shown.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
India India
Started programming with GwBasic back in 1996 (Those lovely days!). Found the hidden talent!

Touched COBOL and Quick Basic for a while.

Finally learned C and C++ entirely on my own, and fell in love with C++, still in love! Began with Turbo C 2.0/3.0, then to VC6 for 4 years! Finally on VC2008/2010.

I enjoy programming, mostly the system programming, but the UI is always on top of MFC! Quite experienced on other environments and platforms, but I prefer Visual C++. Zeal to learn, and to share!

Comments and Discussions

 
-- There are no messages in this forum --