Summary


In practice, it’s extremely difficult to anticipate every condition that can occur within a large application. You should try to predict as many incorrect situations as possible, but you should also plan for unforeseen errors. You should write error-checking code that makes bugs obvious when they occur and recovers from them if possible. You may not be able to anticipate every possible bug, but with a little thought you can make the program detect and report obviously incorrect values. The sooner you detect a bug, the easier it is to find and fix.

You should also look for unexpected conditions (such as the user entering a phone number in a Social Security number field) and make the program react gracefully. Your program cannot control everything in its environment (such as the user’s actions, printer status, and network connectivity), but it should be prepared to act when things aren’t exactly the way they should be.

When you do encounter an error, you can use tools such as breakpoints, watches, and the development environment’s Locals, Auto, Immediate, and Call Stack windows to figure out where the problem begins and how to fix it. You may never be able to remove every last bug from a 100,000-line program, but you can make any remaining bugs appear so rarely that the users can do their jobs in relative safety.

The chapters up to this point have focused mostly on the code that lies behind a Visual Basic application. Another major component to an application is the interface that the user sees. In Visual Basic, you assemble the user interface with forms, and controls and components added to the forms. Chapter 9 introduces the Windows forms controls and components. It describes the most commonly used controls and components and gives some guidelines for selecting those that are most appropriate for different user interface needs.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net