This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

VS 2010+

Visual Studio 2010 Pinned DataTips

Visual Studio 2010 introduces several new features to assist with debugging. The improved DataTips feature allows the contents of variables and members to be made permanently visible, either pinned to the source code or floating above an editor window.


DataTips have been available in several versions of the Microsoft Visual Studio integrated development environment (IDE). A DataTip appears when a program is running in debug mode and a variable or one of its members is pointed at using the mouse cursor. The tip shows the current contents of the item and, where appropriate, allows the hierarchy of members and their values to be browsed.

Pinning a DataTip

In Visual Studio, DataTips can be pinned to the source code. This stops a DataTip from being hidden when another is displayed, making it much easier to monitor individual values. When a tip is visible, it can be pinned by clicking the pushpin icon to the right of the variable name and value. If the item being inspected includes multiple members, several can be pinned in the same tip by simply clicking more than one pushpin. Once pinned, the DataTip retains its position relative to the source code when you scroll the editor window.

NB: You may also pin a DataTip by right-clicking an item in the source code and selecting "Pin To Source" from the context-sensitive menu that appears.

Deleting DataTips

Once a DataTip is pinned, pointing at it displays several tools. These appear to the right of the tip's box, as pictured below:

Visual Studio 2010 Pinned Variables

If you no longer wish to see the DataTip, is can be permanently removed by clicking the "X" icon. However, you do not need to remove DataTips each time you use the debugger. If you decide to leave the DataTips in place, they will disappear when you stop debugging. When you re-run your program, the DataTips reappear.

Moving DataTips

Sometimes the default position for a new DataTip is not ideal, perhaps because it obscures some code. You can move a tip by dragging it to a new position.

Floating DataTips

A floating DataTip is similar to a pinned tip, except that it does not move when the editor window is scrolled. Instead, the DataTip remains visible in the same screen position. To switch between a pinned and floating DataTip, click the pushpin icon from the three tools alongside the tip's box. As with pinned DataTips, floating tips can be dragged around the screen.

DataTip Comments

The third icon for a DataTip expands the DataTip's box to show a comment area. You can click within the textbox and type plain text information that will be useful during debugging. In the earlier image the comment shows "cm2" to indicate that the area variable represents a number of square centimetres.

Last Value Display

The final element of pinned DataTips that we will consider in this article is the last value display feature. Once you have left debug mode, all DataTips disappear so that they do not obstruct your code. This means that the last values that were held by the monitored items are no longer visible. However, each DataTip has an associated pushpin icon at the left of the code. If you hover over one of these icons, the associated DataTip will be displayed temporarily along with the latest value it held.

27 April 2010