Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

2. It’s All Just Code: Under the hood > Use the debugger to see your variables ...

Use the debugger to see your variables change

The debugger is a great tool for understanding how your programs work. You can use it to see the code on the previous page in action.

Debug this!

  1. Create a new Windows Forms Application project

    Drag a button onto your form and double-click it. Enter all of the code on the previous page. Then take a look at the comments in the screenshot below:

    Note

    Creating a new Windows Forms Application project will tell the IDE to create a new project with a blank form and an entry point. You might want to name it something like “Chapter 2 program 1”—you’ll be building a whole lot of programs throughout the book.

    image with no caption
  2. Insert a breakpoint on the first line of code

    Right-click on the first line of code (int number = 15;) and choose “Insert Breakpoint” from the Breakpoint menu. (You can also click on it and choose Debug >> Toggle Breakpoint or press F9.)


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint