p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer (http://p2p.wrox.com/forumdisplay.php?f=574)
-   -   Lesson 12 Try It! (http://p2p.wrox.com/showthread.php?t=90288)

John S June 6th, 2013 01:16 PM

Lesson 12 Try It!
 
The Step-by-Step, and also the section on "Reading Variables" pg 153 did not work for me at all.

Using the Express Edition, I had to:

1) Set a Breakpoint, as you noted.

2) Run the program (start DeBugging)

3) The program stops at the Breakpoint and pops-up the form.

4) Press the Enter key on the keyboard. This highlights the code in yellow, and opens the Locals window.

5)NOW you can hover the mouse to see the values of the variables, or press
F10 to step through the code.

**Update:

Even this does not work in all cases.

In Lesson 12, Ex 2 (Celsius to Fahrenheit), setting a Breakpoint next to :

"private void celsiusButton_Click"

and pressing DeBug does not open the Locals window unless I click the Celsius "Go" button in the form.

Rod Stephens June 6th, 2013 04:12 PM

Hi John,

I'm sorry this didn't work as expected and that it sometimes seems inconsistent.

I don't know why you would need to press Enter. My system doesn't do that.

The bottom line is, when the program is stopped you can hover over variables to learn their values. Depending on the line where you set the breakpoint, all I can figure is the program is stopping in slightly different ways.

For example, if you set a breakpoint on a variable assignment (like x = 10), then it should stop before executing that line.

If you try to set a breakpoint on the declaration for a method, it probably sets the breakpoint on the "{" after the declaration.

Sometimes you may need to press F10 to step over a line of code before you can work with the variables in that line.

Visual Studio won't let you set breakpoints on some statements such as comments because the compiler actually strips them out before running the program because they don't really mean anything to the program, just to you.

The Locals, Autos, and other windows may not appear automatically so you may need to display them yourself when you want them. If they're missing and you want them, look in the Debug menu's Windows submenu. (I usually hide those windows and just hover over variables to see their values.)

Unfortunately I can't tell exactly what you'll see in your installation because Visual Studio is highly configurable so your installation may not look quite like mine or anyone else's.

John S June 6th, 2013 07:28 PM

Thanks, Rod ...

It's probably something to do with Express Edition, which is why you don't see the problem.

Rod Stephens June 7th, 2013 01:02 PM

Quote:

It's probably something to do with Express Edition, which is why you don't see the problem.
Possibly. I'm always a bit suspicious of things like this. Most of the differences between the Express Edition and other editions involve which tools are available (for example, the team foundation tools and icon editor are not in the Express Edition) or configuration issues (such as the Immediate window being hidden in the Express Edition).

But Visual Studio is an extremely complicated program and they fiddle with it constantly so it could be a bug, a difference in the editions, or just a case of us not knowing what it is "thinking."


All times are GMT -4. The time now is 12:30 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.