Now that there is some functionality in our application, we can run it in the debugger and see how it works. Place a breakpoint next to the only line of code in the event handler; this is done by clicking on the grey area to the left of the code. When you do this, a small red dot will appear that represents the place where the debugger will stop.
After setting the breakpoint, simply press
F5 or click the small play button on the menu. This will compile your application and then launch it, as shown in Figure 6.
Enter some text into the checkbox and then click the button. Instead of showing you a message box right away, the debugger will "break" at your break point and drop you into the debugger, as shown in Figure 7.
A couple of new windows appear in the debugger, most notably the Locals and Call Stack windows. The Locals window shows the variables that are currently in scope and what their value is; you can also drill down into the values of the individual properties on each of the objects. The Call Stack window shows where your application is in its current execution path. From here, you could investigate and change the values of variables, or step through the application line by line. In this case, let's just hit
F5 again to let our application continue executing. The message box will be displayed with the contents of the text box, and our application will continue running.
This example is quite simplistic, but it displays some of the most compelling features in Visual Studio and some of the many reasons to use this IDE.
Go Forth and Build
Visual Studio is one of the top IDEs available today for any language or platform and does an incredible job of enabling developers to more efficiently write quality applications using the .NET framework and Windows environment. Visual Studio removes a lot of the pesky and annoying aspects of writing applications and allows you to focus on the application you are writing and the problem you are trying to solve.
Note: Visual Studio is easy to use, but it can be deceptively simple. There are a plethora of features and add-ins you might never become aware of through normal usage. My book, Visual Studio Hacks, points out 100 of these tips, tricks, and tools that you might not otherwise find on your own.
James Avery has been programming with Microsoft technologies for the last 7 years and has been working with .NET since the second beta release.
Return to ONDotNet
- Trackback from http://dotavery.com/blog/archive/2005/09/07/5057.aspx
What is .NET
2005-09-07 18:28:47 [View]
- Trackback from http://blogs.msdn.com/robcaron/archive/2005/08/24/455526.aspx
Suggested Reading - 2005-08-24
2005-08-24 12:43:06 [View]
- Trackback from http://dotavery.com/blog/archive/2005/08/22/4926.aspx
What is Visual Studio
2005-08-22 20:11:06 [View]