Is it possible to change the value of a variable during execution time?

Use the Immediate Window.

Use the Immediate window to debug and evaluate expressions, execute statements, and print variable values. The Immediate window evaluates expressions by building and using the currently selected project.


In VS if you hover your mouse over this variable, you'll notice it displays it's value in a tooltip. You can click into this tooltip and edit it manually - though you need to provide a value of the correct format for the data type. Strings also need quotes "".

There is likely a way to do this via some of the other debugging windows, but I don't know of any. I'll leave those answers to someone else.


Yes. There are several Ways.

Double-click the variables value in the Watch, Local or Auto's window. You can also do this from the immediate window.


In VS, there is the command/immediate window (when debugging, under the Debug -> Windows menu) which allows you to change variable values.

A more visual way is the Variable window.