Who Is Reading This Book?
Writing a book is a lot like writing a Visual Basic application. Well, except for the part about finding a publisher, and working with an editor. And then there's that pesky rule about correct spelling. Come to think of it, they're really quite different. But in one way, books and programs are similar: both are written to meet the needs of the user. When writing software applications, the user's needs drive the organization and features of the final program. When writing a book, like the one you're looking at now, the needs of the userthat's you, the readerdrive the organization and features of the final text.
So it was with you in mind that I set out to write this book. Oh, there's the fame and the prestige, but it's really about you. You, the person who seeks to understand Visual Basic and the .NET Framework on which it is built. When I thought about you and your needs, I came up with these ideas:
You might know how to program, but maybe notIn the programming world, there are four types of people: (1) those who already program joyfully; (2) those who don't program, but will learn it and love it; (3) those who don't program, but will learn it and struggle with it; and (4) those who should return this book immediately to the bookstore. If you are in one of the first three groups, this book is definitely for you. I believe that anyone who can break down a task into its basic step-by-step instructions can successfully program in Visual Basic. If you are unsure about your ability to quantify tasks in this way, you might want to start out with a book on basic programming concepts.
You might know how to program in Visual Basic or .NET, but maybe notAnd that's OK, because this book will teach you. Most of the chapters introduce important topics in Visual Basic and .NET development, such as object-oriented programming concepts, or using the different types of variables available to you, or interacting with a database. If you already know how to use Visual Basic 6 or earlier, that's great, but it's not a prerequisite.
You want to write programsMost programming books teach you to write code in 10-line increments. At least that's what's scattered throughout their pages. I've put some of those "code snippets" in this book. But I spend my days writing real programs, not 10-line sample programs. If you want to write whole programs, you should learn using whole programs. That's why I also put a program in my book a whole program . Over the next several hundred pages, I will develop a real programa database for a small libraryand you will write it with me.
I put all of these ideas into 26 easy-to-read chapters, and had O'Reilly Media glue the pages together for your convenience. When you reach the index, you will have learned how to write complete programs in Visual Basic and .NET. It will be a programming adventure, so let's get started!
What's in This Book?
Since we are going to be spending a lot of time together, you probably want to know something about me. Well, my name is Tim Patrick, and for many years I lived just up the street from the big Microsoft campus. I've been writing programs for 25 years, and these days I write custom database-oriented Visual Basic applications for small to medium-size businesses. And I'm not alone. Most Visual Basic developers write business-level software. If that's what you do, or plan to do, you're in great company.
As you move through the pages of this book, you will read about the major .NET and Visual Basic activities that drive the development of business-level and general consumer applications. If you plan to do some other type of programming, such as game development, this book will be somewhat helpful, but I don't talk about advanced or specialized features such as interactive 3D models or geometric transformations.
Each chapter discusses a major programming topic, and then follows it up with a practical implementation of that topic: the creation of the Library database program. I don't show every line of code in the book; if I did, the book would weigh 53 pounds and cost $254.38, plus tax. To get every line of source code, you'll have to download the accompanying source code from the book's web site. The code and the book's text are united in one purpose: to train you in the skilled use of Visual Basic on the .NET platform so that you can develop the highest-quality applications possible. The text and the source code both include valuable resources that you can use every day in your programming life.
What's in the Software Download?
You're going to like the download. It contains all the source code for the Library database project. What's cool is that when you install the source code examples, they become part of Visual Studio. Once they are installed, you can create a new chapter-specific project right from the File New Project menu in Visual Studio. has all of the download and installation details.
I wrote the project code using Visual Basic 2008 Professional Edition. Some portions may not be compatible with earlier .NET versions of the language. None of it is compatible with Visual Basic 6.0 or earlier, so don't even bother trying. The source code will work with any edition of Visual Basic 2008, including the Express Edition.
The source code also uses SQL Server 2005 for its database storage. You can use any edition of SQL Server 2005, including the Express Edition. introduces databases and SQL Server 2005. If you will be using the database in an IT department-controlled network environment, you may need to talk with your IT department representative about installing the sample database. The SQL code I use is pretty vanilla, so it should work on previous versions of SQL Server, and you could easily adjust it to work with Oracle, DB2, Microsoft Access, or other common database engines. You can also use the upcoming SQL Server 2008 if you have it available.
You can use the downloadable source code for your own projects, but please give credit where credit is due. There is a license agreement associated with the code (see ), so please don't go selling the software as your own work. Just to be on the safe side, I've added a few hard-to-find bugs. Just kidding! (No, I'm not!)