Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

Did you know... You can use the Watch Window to quickly change a variable's value - #149

And now for something a little different...

Ever been debugging some code and wanted to quickly change a variable’s value without having to stop debugging?  Here's what to do...

  1. Add the value to the watch window (You can select the variable and drag it into the watch window as shown below). 
  2. Then, double-click the variable’s contents within the watch window, and you’ll be able to edit.  Either click outside this field or press enter to commit the change, and the variable will contain the new contents.

Dragging Variables into Watch Window 

Commit changes to Watch Window by hitting enter

Contents have changed at run-time

If you need to clear the watch window's variable contents, just hit delete on that row.

Technorati Tags: ,
Posted: Tuesday, February 12, 2008 3:00 AM by saraford

Comments

Rory Primrose said:

I found you can do the same thing from hoving the mouse over a variable. You can change any primitive value in the object hierarchy displayed in the popup. So very handy!

# February 12, 2008 4:33 PM

Noticias externas said:

wow... 150 tips.  And just like the Energizer bunny , Tip of the Day keeps going and going and going

# February 13, 2008 7:01 AM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# February 13, 2008 10:50 AM

Tom said:

Actually, this isn't even limited to primitives...  If you have an object instance in your watch you can actually create an instance right there just by typing 'new Whatever()'...  It's frickin amazing :)

# February 28, 2008 1:36 AM

xjb said:

# December 24, 2008 10:16 PM
New Comments to this post are disabled
Page view tracker