共用方式為


Cannot Change Value Dialog Box

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Error
The value of this variable cannot be changed | The name name does not exist in the current context | various other messages

This message box appears when you try to change the contents of a variable to an illegal value in a debugger window (Autos, Watch, or Locals windows) or in the QuickWatch dialog box. For example, if you try to set the value of an integer variable to a character string, this message box appears.

Solution

Make sure the input you type into the debugger window or QuickWatch dialog box represents a legal value for the variable you are trying to set.

See Also

Expressions in the Debugger