View data values in Data Tips in the code editor
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
DataTips provide a convenient way to view information about variables in your program during debugging. DataTips work only in break mode and only with variables that are in the current scope of execution.
In Visual Studio 2010, DataTips can be pinned to a specific location in a source file, or they can float on top of all Visual Studio windows.
In a source window, place the mouse pointer over any variable in the current scope.
A DataTip appears.
Data tips are always evaluated in the context where execution is suspended, and not where the cursor is hovering. If you hover over a variable in another function with the same name as a variable that is in the current context, the value of the variable in the other function is displayed as the value of the variable in the current context.
The DataTip disappears when you remove the mouse pointer. To pin the DataTip so that it remains open, click the Pin to source icon, or
- Right-click on a variable, then click Pin to source.
The pinned DataTip closes when the debugging session ends.
In a pinned DataTip, click the Unpin from source icon.
The pin icon changes to the unpinned position. The DataTip now floats above any open windows. The floating DataTip closes when the debugging session ends.
In a DataTip, click the pin icon.
The pin icon changes to the pinned position. If the DataTip is outside a source window, the pin icon is disabled and the DataTip cannot be pinned.
- Place the mouse pointer over a DataTip, and then click the Close icon.
- On the Debug menu, click Clear All DataTips.
- On the Debug menu, click Clear All DataTips Pinned to File.
You can use DataTips to expand an array, a structure, or an object to view its members. You can also edit the value of a variable from a DataTip.
In a DataTip, put the mouse pointer over the + sign that comes before the variable name.
The variable expands to show its elements in tree form.
When the variable is expanded, you can use the arrow keys on your keyboard to move up and down. Alternatively, you can use the mouse.
In a DataTip, click the value. This is disabled for read-only values.
Type a new value and press ENTER.
If you want to see the code that is behind a DataTip, you can make the DataTip temporarily transparent. This does not apply to DataTips that are pinned or floating.
In a DataTip, press CTRL.
The DataTip will remain transparent as long as you hold down the CTRL key.
If a magnifying glass icon appears next to a variable name in a DataTip, one or more Create Custom Visualizers are available for variables of that data type. You can use a visualizer to display the information in a more meaningful, usually graphical, manner.
Click the magnifying glass icon to select the default visualizer for the data type.
Click the pop-up arrow next to the visualizer to select from a list of appropriate visualizers for the data type.
A visualizer displays the information.
If you want to continue to watch a variable, you can add the variable to the Watch window from a DataTip.
Right-click a DataTip, and then click Add Watch.
The variable is added to the Watch window. If you are using an edition that supports multiple Watch windows, the variable is added to Watch 1.
You can export DataTips to an XML file, which can be shared with a colleague or edited using a text editor.
On the Debug menu, click Export DataTips.
The Export DataTips dialog box appears.
Use standard file techniques to navigate to the location where you want to save the XML file, type a name for the file in the File name box, and then click OK.
On the Debug menu, click Import DataTips.
The Import DataTips dialog box appears.
Use the dialog box to find the XML file that you want to open and click OK.