DevCity.NET -
Review: The Book of Visual Basic 2005
Ged Mead

Ged Mead (XTab) is a Microsoft Visual Basic MVP who has been working on computer software and design for more than 25 years. His journey has taken him through many different facets of IT. These include training as a Systems Analyst, working in a mainframe software development environment, creating financial management systems and a short time spent on military laptop systems in the days when it took two strong men to carry a 'mobile' system.

Based in an idyllic lochside location in the West of Scotland, he is currently involved in an ever-widening range of VB.NET, WPF and Silverlight development projects. Now working in a consultancy environment, his passion however still remains helping students and professional developers to take advantage of the ever increasing range of sophisticated tools available to them.

Ged is a regular contributor to forums on vbCity and authors articles for DevCity. He is a moderator on VBCity and the MSDN Tech Forums and spends a lot of time answering technical questions there and in several other VB forum sites. Senior Editor for DevCity.NET, vbCity Developer Community Leader and Admin, and DevCity.NET Newsletter Editor. He has written and continues to tutor a number of free online courses for VB.NET developers.

by Ged Mead
Published on 6/24/2006

  Matthew MacDonald is a well-known and respected technical book author.    I already own and regularly use several of his previous .NET books, so when this one came out I was particularly interested to see if it came up to his usual high standard.


  Overall, I was impressed with the detail and clarity of this book which was firmly targeted at Classic VB developers who are ready to move on to .NET now that the promised improvements in VB2005 are finally here.




Who is this book aimed at?   The sub-title of the book gives us the definitive answer to that question. 

It reads:

The Book of Visual Basic 2005

.NET insight for Classic VB developers

  No scope for confusion there, then!  

  By current standards, this is a medium length book of just over 470 pages.   Of course there are many thin and useful books, just as there are many large and unhelpful ones; size, as they sometimes say in another context, isn't important.  Quality is, though.

   Classic VB upgraders probably need two key things from a .NET book:  Firstly,  "What's in it for me?" advice.  That is, guidance on what benefits they may gain from making the switch, plus honest information on the downsides. 

   Although the marketing material from Microsoft covers the benefits in great detail, it is useful to have an unbiased version of this, a view distilled through the perspective of an experienced user.  For the same reason, negative information based on experience is also very valuable.

   Secondly, for developers who are ready to make the change it is very helpful to have new features in VB2005 (and less importantly Visual Studio 2005, for that matter) clearly highlighted.   Perhaps even more crucial, to cut down the amount of wasted time in the learning curve, they need clear guidance on those sometimes small, but fundamental changes that have been made to classic VB methods.   By this I mean those where the name hasn't been changed, but some key requirement or result has.  The scope for frustration in these areas is huge.

    I think that Matthew MacDonald has scored well on all these requirements.   The book is filled with comparisons between Classic and VB2005, differences clearly explained with short code snippets where practicable.   

   For example, quite early on the limitations of classic VB get fair coverage and this is followed by two sections named:

Ten Enhancements You Can't Live Without
Ten Changes That May Frustrate You

   And the book takes this fairly even-handed approach throughout.   The benefits of .NET are highlighted, but the effort required to make the change isn't overlooked or underestimated.

  To take another example, he highlights the benefits of the My object, such as discoverability using Intellisense, but doesn't duck the dark side - the potential pitfalls.  As My was brought in specifically to seduce and appease Classic VB-ers, it is good to see both sides of the story being honestly presented.

  As regards new features and controls, these are covered in some depth, supported by screenshots and useful diagrams.

  Each chapter has a "New in .NET" section with high level, mostly positive coverage of what are included in the new features.  These are then covered in much more detail later in the chapter.  In some chapters I see that "New-to-VB2005" features are also given separate treatment; useful for those who have already played with .NET 2002 and 2003.

  That's an overview.  Let's take a look at the contents.



Book Contents


Chapter 1: The .NET Revolution

   As mentioned already, the author looks at the big picture of Visual Basic and the .NET Framework, an overview of what has changed, why it is different and an idea of what life may be like for you in the brave new world of VB2005.

Chapter 2: The Design Environment

   In this chapter, he looks specifically at changes in the IDE and homes in on new features such as enhancements to Intellisense, macros and the all-new Code Snippets.  It includes a quick tour of the various IDE Windows, plus the various ways you can use, display and hide them.

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

  Often squeezed in and looking like an afterthought in many books (and even left out altogether in others), the final chapter in this book covers this topic in some detail.   I like the honest description the author gives of the new ClickOnce deployment; "Developers who are searching for a streamlined setup option may appreciate ClickOnce, a new .NET 2.0 feature that's taiolored for creating setup applications that users can install from a website.  Without doubt, the greatest feature of ClickOnce is its support for automatic update checking, while its most significant limitation is that it provides very few options and stubbornly resists all customization."

   And on the topic of the more developer-intensive, but greatly adaptable "standard" setup via Visual Studio: "Visual Studio includes a much more powerful feature for building setup projects that can be added directly to your Solution files and configured extensively.  With a Visual Studio setup project you can copy whatever files you want, create shortcuts, configure the registry, and more.   You may never need to resort to a third-party installation tool again."

  A detailed walkthrough of using ClickOnce via a web site and also publishing to CD follows the introduction sections.   The next 14 pages then steps through in some detail how to create a Setup Project 




    Having travelled the Classic VB route myself, even though I have been using VB.NET for some time, I still found much that was useful, new and interesting in this book.   I am sure that its intended target audience of VB6 developers who have not yet left their comfort zone and defected to .NET will find it of tremendous value.  

    Of the two VB205 upgrader books that I have seen by this author, this one is in my opinion by far the better.   (The other book is aimed at VB.NET developers who just needed a heads up on new VB2005 features and this book for newcomers is therefore a more comprehensive offering.)

   There is enough coverage of new topics to enable upgraders to get to grips with unfamiliar techniques and the author is careful to highlight several Gotchas that would otherwise trip up the unwary VB6 developer.   His approach is even-handed and honest - no claims being made here that all change is good for its own sake.   Where upgraders may have problems or be disappointed with changes, these issues are not ducked.   That said, overall this book takes a very positive and supportive approach to the upgrade journey.  

   With the exception of my comment below, all the code samples I tried worked and were free of typos  (a pet hate of mine - it's hard enough to learn this stuff, without having to play Hercule Poirot along the way).    So full marks to the author and publishers on that score.  

   The proof of the code sample is in the using, as they say (or something like that!).   So it was gratifying to find that I was able to use the sample on printing with word wrap in Chapter 9 less than 24 hours after I had first read it.   A question on one of the VBCity Forums was easily and comprehensively answered thanks to the availability of that particular sample.    I am sure many of the others will prove useful in coming months too.


   I did try out some of the downloadable code sample projects.   All those I tried did perform correctly, although in Chapter 5's sample set the same project has been included in two different solutions.  So effectively one demo is missing there.    

   There doesn't appear to be an Errata link on either the publisher's site or the author's.   However an email to Matthew MacDonald  (as per his invitation in the introductory sections) produced a speedy and positive response, and I understand that this is in process of being implemented now.  

  I did think that the "File Information" example download in Chapter 9 might be in danger of confusing the newcomer.   Unless you follow very carefully you may expect to see an on-screen change of data; and when it doesn't change you may be confused.   The code isn't incorrect as such ; it's just that the code changes one particular Property (LastWriteTime) but displays a different one (CreationTime) in the TextBox used to display output.   It won't detain experienced programmers for long, but might give a relative newbie a passing WTF moment.  


    Those very minor moans out of the way, there is no question that what we have here is a well-written book in the clear, plain English, understandable style of an experienced author who knows his subject thoroughly.   The subject matter is relevant to the target audience and is as comprehensive as space allows. 

   Plenty of useful and relevant Note and Tip sidebars are scattered throughout each chapter.   The author keeps his target audience in mind at all times.   The walkthroughs are detailed and contain helpful information on pitfalls and features that Classic VB developers will find useful.

   If you are ready to make the transition from Classic VB to VB2005, this book will be of great assistance to you in that process.   As you will often see me say in these DevCity book reviews, this may not be the only book you need before your bookshelf is completely stocked with everything you need*.  However, if you are in the target readership, this useful guide will take you a long way down the road.





*  Although by the time you have, Vista and Orcas will probably have arrived and you'll be back to your favourite bookstore to restart the cycle!