DEBUGGING AND TESTING

The Visual Basic code editor described in Chapter 5, “Visual Basic Code Editor,” provides tools that make writing Visual Basic applications relatively easy. Features such as error indicators, tooltips, and IntelliSense help you write code that obeys the rules of Visual Basic syntax.

No code editor or any other tool can guarantee that the code you write actually does what you want it to do. Debugging is the process of modifying the code to make it run and produce correct results.

NOTE
Testing tools such as those included in some versions of Visual Studio and third-party tools such as NUnit (http://www.nunit.org) can do a lot to ensure that your code runs correctly, but they work only if the code you write does the right things. If you need a billing system but write an inventory application, no tool will save you.

Depending on the application’s complexity, debugging can be extremely difficult. Although Visual Studio cannot do your debugging for you, it does include features that make debugging easier. It allows you to stop execution while the program is running so you can examine and modify variables, explore data structures, and step through the code to follow its execution path.

This chapter explains Visual Basic’s most important debugging tools. It describes the tools available in the Debug menu and the other IDE windows that are most useful for debugging.

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.