Welcome to our big book on Visual Basic. It's no secret that Visual Basic is the most popular programming tool available today. And it's also no secret that there have been massive changes in the latest version, Visual Basic .NET. If you've read previous editions of this book, you'll find a lot that's new here—in fact, just about everything is new. Almost this entire book has been rewritten.
Why the big change? The reason is Visual Basic itself, which has now become Visual Basic .NET (also called VB .NET). The difference between Visual Basic .NET and the previous version, Visual Basic 6.0, is revolutionary and far reaching. Visual Basic .NET has been almost three years in the making, and it represents entirely new directions for Visual Basic. Besides the biggest change—integrated support for Web development—the very syntax of Visual Basic has undergone tremendous changes. A great number of techniques that you've probably learned carefully are now completely different, such as data handling, and many controls, project types, and other aspects of Visual Basic 6.0 are no longer available at all. All of which means that there's a terrific amount of material we need to cover—so I'm going to pack as much Visual Basic .NET into this book as will fit.
Our coverage of the new Visual Basic is not going to be like some other books that hold their topic at an arm's length and just give you dry documentation. This book is written from the programmer's point of view, for programmers, and I'm going to try to give you as much of the good stuff as I can. I use Visual Basic .NET a lot myself, and I know that to master this subject, nothing is better than an in-depth treatment with many examples and tips that will save you a lot of time.
Visual Basic has a long and, so far, glorious history. When it first appeared, it created a revolution in Windows programming. Visual Basic introduced unheard-of ease to Windows programming—just build the program you want, right before your eyes, and then run it. In so doing, it changed programming from a chore to something very like fun.
In time, Visual Basic has gotten more complex, as well as more powerful. Today, it's more complex than ever, and if you've used Visual Basic 6.0, you may be surprised at all the new additions. In this book, you'll see how to use Visual Basic in a task-oriented way, which is the best way to write about programming. Instead of superimposing some abstract structure on the material in this book, I'll organize it the way programmers want it—task by task.
I'll start with an overview of Visual Basic, taking a look at topics common to the material in the rest of the book. In this chapter, we'll create the foundation we'll rely on later as we take a look at the basics of Visual Basic. This includes learning how to create Visual Basic projects, seeing what's in such projects, seeing what's new in Visual Basic .NET, getting an overview of essential Visual Basic .NET concepts such as Windows and Web forms, controls, events, properties, methods, and so on. Note, however, that I'll assume you have at least a little experience with Visual Basic and programming in this chapter.
I'll also give you a guided tour of the Visual Basic Integrated Development Environment—the IDE—that we'll be using continuously throughout this book. The IDE is what you see when you start Visual Basic, and it's where you develop your applications and debug them. Understanding the IDE and how to use it—and mastering some fundamental Visual Basic concepts—will give us the foundation we need for the rest of the book.
Many Visual Basic programmers do not have formal programming training, so they have to learn a lot of this material the hard way. As programming has matured, programmers have learned more about what are called "best practices"—the programming techniques that make robust, easily debugged programs. We'll take a look at those practices in this chapter, because they are becoming more essential for programmers in commercial environments these days, especially those programmers who work in teams. And we'll look at those practices from the viewpoint of programmers who program for a living, because frequently there's a gap between the way best practices are taught by academics and how they are actually needed by programmers facing the prospect of writing a 20,000 line program as part of a programming team.
Before we start covering all the details in Visual Basic in depth, let's take a look at an example first. Rather than getting lost in the details, let's see Visual Basic at work immediately. Because there are so many details one has to master, it's easy to forget that Visual Basic is there to make things as easy as possible for you. In fact, as stated earlier, programming in Visual Basic can be as close to fun as programming gets.