Chapter 3: VB 2005 Basics
Chapter 3 introduces some of the core .NET language concepts including namespaces, assemblies, references, the common class library and data types. Differences between Classic VB and VB2005 in areas such as arrays, strings, default instances and (sometimes subtle) changes in the data types are covered here.
There is an overview of some of the more important or most commonly used classes. The new My object is covered in some detail - the pros and cons being given equal coverage.
Chapter 4: Windows Forms
This chapter begins with a quick run through the major changes in Windows Forms. More detailed coverage is then given to anchoring, docking, scrolling, container controls and splitting. The new feature of Custom Designers is also given brief mention, although I would have liked to have seen more details and examples of this facility. Other features covered include Accept and Cancel buttons, in-depth explanations of the changes to form instance creation and dynamically created controls on forms.
Multiple forms, including changes to MDI, are also covered. A selection of new controls are given further insight and these include the ToolStrip, MenuStrip, ContextMenuStrip, Help and Error Providers.
Chapter 5: Object-Oriented Programming
Some of the coverage in this introductory chapter on this very large topic is necessarily superficial, but nevertheless the key concepts are covered. It begins with Structures (now more a Classic VB tool than a .NET one) and moves on to full-blown classes, explaining the benefits of enhancing a class with Properties, Overloaded Constructors, Events and so on. Enumerations are also very clearly explained in this chapter.
Chapter 6: Mastering Objects
The philosophy of Object Oriented Programming is covered in this chapter, together with a wide range of techniques and approaches - Inheritannce, Protected members, Overriding, Casting, Abstract Classes. How, why and when to use Interfaces are all covered well. The chapter ends with a clear explanation of Collection Classes, with worked examples, including the new-to-VB2005 Generic Collection.
Chapter 7: Assemblies and Components
Assemblies - what they are, how they are used and what advantages they bring to the table are well covered. There is a swift canter through an example of how to create a component in a class library and access it through a client. The Global Assembly Cache, Strong Naming and Versioning are explained with a short walkthrough. The chapter ends with an explanation of adding and using Resources in VB2005, an example which embeds a graphics file being shown.
Chapter 8: Bug Proofing
The totally different approach to error handling which is taken in .NET is covered in this chapter, i.e. Structured Exception Handling. As an introduction, the various kinds of errors which can occur are described - editor mistakes, compile time errors, runtime errors, logic errors and the whimsical "Errors that can't happen" category: Proof of one of Murphy's Laws, "Even if something can't go wrong, it will".
The reasons for turning Option Strict and Option Explicit On are explained, followed by brief walkthroughs of some of the many debugging tools and windows now available in VB2005.
While letting readers know that the relatively ugly On Error GoTo command is still available, the author goes to some trouble to explain the valid reasons why they should wean themselves off it and use Structured Exception Handling instead. This important topic of Exception Handling is given comprehensive coverage throughout.
Chapter 9: Dealing with Data: Files, Printing, and XML
This chapter begins by taking a quick look at the limited benefits of using the My object (and My.Computer.FileSystem in particular) to read and write relatively small chunks of text to and from files. It then moves on to the more sophisticated methods using Streams, StreamReader, StreamWriter, BinaryReader and BinaryWriter.
The FileInfo class is introduced and contains some crucial information about the importance of bitwise comparison when setting or reading file attributes. The DirectoryInfo class is then used to demonstrate how to create a simple Directory Browser which will list all folders, subfolders and files on a drive - something I have seen raised as a question in .NET Newbies many times. Even better, the author points out that populating the TreeView can often be a slow operation and provides a downloadable working alternative which allows users to select folders and sub folders to view.
FileSystemWatcher gets a concise review. This is followed by a further look at Serialization. I was relieved to find this section as I had not been too impressed with the earlier example. But, as became clear in the author's own words:
"The program we looked at earlier used a relatively crude (but effective) mode of handmade Serialization."
the more sophisticated approach of creating a Serializable Class was not going to be overlooked and there is a useful example, plus an explanation of how to use the NonSerialized Attribute when necessary.
Although Printing has become easier (some say), most people find that it is still a relatively complex subject. The examples and explanations in this chapter are certainly clear enough to get you over the initial hurdle of getting to grips with printing basics. Also available for additional guidance and dissection is the working, commented downloadable Solution "Print Test".
Beginning with the question "What is XML, anyway?" (and providing a very clear answer) the final pages of this chapter cover XML basics. If you are new to XML you will find this relatively short introduction easy to follow and helpful
Chapter 10: Databases and ADO.NET
As well as a brief introduction and overview of database access and ADO.NET features, this chapter also delves back into XML, specifically with regard to how it is used in DataSets. DataSets, DataAdapters, DataBinding, Command Objects, DataReaders, Transactions and Parameterized Commands are just some of the topics covered in this potted tutorial in this major field of study. Concurrency problems and how to handle them was, I thought, particularly well explained.
Chapter 11: Threading
In this coverage of the sometimes difficult and often misunderstood subject of Threading the author begins by explaining the reasons why you should (and sometimes should not) use Threading in your projects. The BackGroundWorker class is then described in some detail, followed by sections of basic thread management and thread synchronization. You can read the whole of this chapter on line at the publisher's web site here.
Chapter 12: Web Forms and ASP.NET
The space available for this major topic inside a single chapter means that it barely scrapes the surface. That being said, there is room for a basic introduction, the creation of a simple example, View State, Session State, Application State, the briefest coverage of data handling, deployment, IIS and virtual directories. I suspect that this chapter is only squeezed in to avoid the kind of complaints that always seem to surface on amazon reviews if someone's favourite topic doesn't get at least minimal coverage. But if nothing else it gives the target audience (Classic VB Upgraders) a first look at the new world order of ASP.NET 2.0 .
Chapter 13: Web Services
"What is a web service, anyway?", the author asks and then goes on to explain in some detail with examples just what it is ... and what it isn't. The similarities to, and differences from, COM objects (something with which many Classic VB-ers will be very familiar) are covered.
This is followed by a detailed walkthrough on how to create a simple Web Service (drawing usefully on previous guidance for setting up IIS and Virtual Directory first.) Actually it turns out to be two simple Web Services. Don't make the same mistake as I did and jump to the conclusion that there is a typo in the second demonstrated WebMethod. The two examples may look the same, but as the author quite explicitly explains, the second one is specifically described as being an enhancement of the first approach. (Note to self: Pay more attention before reaching to grab your red pen)
Chapter 14: Setup and Deployment