Summary


As mentioned in Chapter 1, a major weakness of pre-.NET versions of Visual Basic was limited error-handling capabilities. As you’ve seen in this chapter, that problem has been thoroughly addressed. Errors and unexpected conditions are now packaged as exceptions, and these exception objects have special syntax to detect and manage them. The Try...Catch...Finally...End Try construct allows Visual Basic’s error-handling capabilities to be on a par with other advanced languages.

This chapter reviewed the exception object and the syntax available to work with exceptions. You have looked at the various properties of exceptions and learned how to use the exposed information. You have also seen how to promote exceptions to consuming code using the Throw statement, and how structured exception handling interoperates with the old-style On Error. As discussed, any new code you write should use the new exception-handling capabilities of .NET. Avoid using the old-style On Error except for maintenance tasks in old code.

Also covered are other topics related to error handling:

  • Error logging to Event Logs and trace files

  • Instrumentation and measuring performance

  • Tracing techniques

Using the full capabilities for error handling that are now available in VB 2005 can make your applications more reliable and help you diagnose problems faster when they do occur. Proper use of tracing and instrumentation can also help you tune your application for better performance.




Professional VB 2005 with. NET 3. 0
Professional VB 2005 with .NET 3.0 (Programmer to Programmer)
ISBN: 0470124709
EAN: 2147483647
Year: 2004
Pages: 267

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