fizzer
fizzer

Reputation: 2329

Visual Studio debugger - Displaying integer values in Hex

I'm using Visual Studio 2008 and I have just noticed that the debugger is displaying integer values as Hex when I hover over variables and also in the immediate window. I guess I must have hit a shortcut key accidently or something.

Anyone had this before? How do I set it back to display in decimal?

Upvotes: 178

Views: 103660

Answers (8)

Alf Magne Meling
Alf Magne Meling

Reputation: 1

Visual Studio 2022 17.8.3

The only available selection for changing HEX display mode is in the Watch window. Have to perform a breakpoint and then add a watch variable. Then the hexadecimal mode can be turned off. There is no general selection for the output window for this.

Upvotes: 0

John Pittaway
John Pittaway

Reputation: 929

Visual Studio 2017 Decimal vs. hexadecimal display is controlled only from the Watch dialog.

  1. Break after setting the variable.
  2. Right mouse click the variable and select "Add Watch" or "QuickWatch"
  3. Right mouse click the line in the Watch dialogue.
  4. Uncheck "Hexadecimal Display"

The display will now be in decimal.

enter image description here

Upvotes: 8

user2704583
user2704583

Reputation: 61

In the immediate window you can uncheck the Hexadecimal Display option.

Upvotes: 3

DJ'
DJ'

Reputation: 539

There is a Hex button shown when Visual Studio is run in Debug mode to enable/disable the Hex display

Visual Studio Debug Mode - hex button

Upvotes: 23

Glenn Slayden
Glenn Slayden

Reputation: 18799

You can also choose hexadecimal or decimal display on a per-variable basis in the Visual Studio watch window by appending a debugger format specifier to the variable name. In the watch window, enter:

myInt,h
myInt,d

The other very useful format specifiers are ac (see footnote) for 'always calculate', and nq for displaying with 'no quotes.' They can be used together:

my_string_func(),ac,nq

nq is useful inside DebuggerDisplay attributes, which can appear on a class:

[DebuggerDisplay("{my_string_func(),nq}")]
class MyClass
{
    /* ...example continues below... */

...or on one or more field(s) inside a class:

    [DebuggerDisplay("{some_field,nq}", Name="substitute name here")]
    int an_integer;

    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    String some_field;
}

http://msdn.microsoft.com/en-us/library/e514eeby(v=VS.100).aspx

  • note that earlier versions of the MSDN doc page incorrectly said 'Ac' (with a capital 'A')--which doesn't work

Upvotes: 53

Leniel Maccaferri
Leniel Maccaferri

Reputation: 102428

Right-click your Watch Window or Immediate Window and uncheck Hexadecimal Display option.

enter image description here

Upvotes: 323

marchewek
marchewek

Reputation: 561

Right-click on client space of almost every debug window (except Immediate Window) - watch/locals/autos/threads/call stack - and uncheck "Hexadecimal Display" option. There's also a "Hex" button in debug toolbar (right to "Step Over" by default) when debugging.

Upvotes: 15

Joe
Joe

Reputation: 91

In Visual Studio 2010 I also saw it in the Debug toolbar, it was highlighted in yellow 'Hex', I just clicked it and it returned to (normal) decimal values

Upvotes: 9

Related Questions