Microsoft Visual Basic began its life just eleven years ago as a kind of amalgamation of Microsoft’s QBasic programming language and a graphical interface design program developed in part by Alan Cooper. Since then, it has become by far the most popular programming language in the world, with an installed base that is estimated at five to eight million developers worldwide.
The tenth anniversary of Visual Basic coincided with the announcement of Microsoft’s new .NET platform, and with a totally revised and revamped version of VB named Visual Basic .NET. The language has been streamlined and modernized, and many old “compatibility” elements have been dropped from the language, while other language elements that were implemented as statements are now either functions or procedures.
In addition, many of you will be glad to hear that Visual Basic is now a fully object-oriented programming language, with the inclusion of the long sought-after class inheritance, as well as other OOP features.
We suspect that many of you will greet with mixed emotions, as do we, the fact that Microsoft’s Component Object Model (COM), the technology that was at the core of Visual Basic since the release of Version 4.0, has been abandoned in favor of the .NET platform. On the one hand, we find this to be a great relief, because COM can be so complex and confusing. On the other hand, we find this somewhat irritating, because we have invested so much time and effort in learning and using COM. Finally, we find this change somewhat frightening; who knows what pitfalls await us as we become more familiar with this new technology?
The best news of all is that, whereas in the past, Visual Basic served as a “wrapper” that simplified and hid much of the complexity of Windows and the Windows operating system, at long last Visual Basic is an “equal player” in the .NET Framework; Visual Basic programmers have full and easy access to the features of the .NET platform, just as Visual C++ and C# programmers do.
The extensive changes to the language and the introduction of the .NET platform make a reference guide to the Visual Basic language more essential than ever. At the same time, they make it easy to delineate this book’s subject matter. This is a book that focuses on the language elements of Visual Basic .NET — on its statements, functions, procedures, directives, and objects (notably the Err and Collection objects).
While it’s important to emphasize that this book focuses on the Visual Basic language components for the .NET platform, it’s also important to emphasize what this book is not:
It is not a reference guide to Visual Basic for Applications (VBA), the programming language used in all of the major applications in the Microsoft Office suite, as well as in dozens of other third-party applications. As you probably know, VBA is the programming language in previous versions of Visual Basic and in the major Office applications. However, VBA is not the programming language for VB.NET. Indeed, until VB.NET is incorporated into a release of Microsoft Office for .NET, the two languages will differ significantly.
It is not a reference guide to the .NET Framework Class Library. To be sure, the Framework Class Library is discussed in these pages, and a number of its classes and their members are documented in this book’s reference section. But that documentation just scratches the surface; the Framework Class Library consists of over 90 namespaces (one of which, incidentally, is Microsoft.VisualBasic, the namespace that defines the objects of the Visual Basic language), several thousand types (classes, interfaces, delegates, and enumerations), and an enormous number of members. In selecting the .NET Framework classes to document in this book, we’ve tried to focus on .NET elements that replace commonly used features in previous versions of Visual Basic, as well as on .NET elements that expand and enhance the functionality of existing Visual Basic .NET elements in significant ways.
It is not a reference guide to the attributes that you can apply to program elements. To be sure, Chapter 8 introduces attribute-based programming, and there are entries for important language-based attributes in the reference section. But of the more than 200 attributes available in the .NET Framework Class Library, only language-related attributes and the general-purpose attributes VB developers are most likely to use are documented in this book.
It is not a guide to developing applications or components using Visual Basic .NET. In documenting the language, we’ll show you some simple code fragments that illustrate the relevant issues and show you how a language element works. On the other hand, we won’t show you, for example, how to use the Windows Forms package to build a Windows application, how to develop a web application using ASP.NET, or how to implement a web service.
There are literally hundreds of books lining the shelves on how to program using Visual Basic, and they will no doubt be joined by a flood of books on how to program in VB.NET. The majority of these books assume that you’re a complete novice and slowly introduce you to such concepts as variables, arrays, and looping structures.
This is a different kind of book, however. It is a detailed, professional reference to the VB.NET language — a reference that you can turn to if you want to jog your memory about a particular language element or a particular parameter. You’re also looking for a reference that you can turn to when you’re having difficulty programming and need to review the rules for using a particular language element, or when you want to check that there isn’t some “gotcha” you’ve overlooked that is associated with a particular language element.
In addition, we believe this book will serve as the main reference for VB 6 programmers who are upgrading to VB.NET. To this end, we have devoted considerable space to the extensive language differences between VB 6 and VB.NET. For each relevant language entry, we have included a “VB.NET/VB 6 Differences” section that details the differences in the operation of the language element between VB 6 and VB.NET.