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

Amokrane Chentir picture Amokrane Chentir · Jun 4, 2010 · Viewed 50.4k times · Source

I want to know if there is any way I can change the value of a variable during execution time, using Visual Studio 2008? I know I can do this on Eclipse (put a breakpoint, add a watcher and edit whatever variable value I want) but I didn't find this feature on VS yet?

Any idea?

Thanks.

Answer

Adam Houldsworth picture Adam Houldsworth · Jun 4, 2010

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.