Visual Basic 5, with CD-ROM (Mastering)
Authors: Evangelos Petroutsos
Venue:  (1997)

From the Book:Several years ago, when Visual Basic was a "small" language, a Mastering book would cover every aspect of it. Since the first version, however, Visual Basic has evolved into a major development environment that covers every aspect of programming, from educational applications to database programming, and from financial applications to developing Internet components. Writing a book that even introduced all these topics would be out of the question. Especially a Mastering book. The topics covered in this book were chosen to provide a solid understanding of the principles and techniques involved in developing applications with Visual Basic. Programming isn't about new keywords and new functions. I chose the topics I felt every programmer should master in order to master the language. One of the biggest chapters in this book discusses the graphics methods of Visual Basic. There's nothing new in this area, but graphics are such an important part of the language that the related techniques had to be explained in detail. Most chapters in this book are really version-independent. They will be just as useful to people who are still using version 4 of the language. Another motivation for choosing the topics of the book was my desire to present useful, practical examples. Some of you may not find all topics equally interesting. My hope is that everyone will find something interesting and something of value, whether it is an application such as DirMap, a clear explanation of a topic, or the introduction to Internet programming techniques with Visual Basic. Some chapters do deal with the new face of Visual Basic. If I could isolate a single feature ofthe language that could be considered the most important new feature, it would have to be the development of ActiveX controls, and this feature opens enormous possibilities and new markets for VB developers. This aspect of Visual Basic is covered in Chapter 14, where I've tried to show the similarities between developing VP applications and ActiveX controls and demonstrate through the examples how you can apply your VB knowledge to developing custom ActiveX controls. You will notice that the last part of the book is about the Web. This information was included because of its broad appeal. The Desktop and the Web are merging, and VB programmers should be able to apply their knowledge to the Web. Most of the last part of the book is about VBScript, which is a subset of Visual Basic. VBScript is the language used in developing Web applications -- another lucrative market for VB developers. The chapters in the last part of the book are short compared with the others, not because I got tired toward the end of the book, but because my intention was to discuss the topics that are new to VB developers and avoid rehashing information that most VB programmers would find trivial. Who Should Read This Book You don't need a solid knowledge of Visual basic to read this book, but you do need a basic understanding of programming. You need to know the meaning of variables and functions and how an If Then structure works. The first two chapters are introductory, but they are not meant for the absolute beginner. Instead, they were included to introduce Visual Basic to users with programming experience in a different environment. Occasional users of previous versions of Visual Basic will also find interesting information in these chapters. If you have no programming experience, you should probably start with another, simpler book. Chapter 3, Visual Basics, the Language, is mostly reference information about data types and procedures. It's information that every programmer needs from time to time. While reading the rest of the book or exploring the code of an application, you might need to look up how to use optional parameters or how to implement a collection. Consult Chapter 3. With Chapter 4, we get into real VB programming. This book is addressed to the average programmer who wants to get the most out of Visual Basic. It covers the topics I feel are of use to most Visual Basic programmers. Visual Basic is an extremely rich programming environment, and I had to choose between a superficial coverage of many topics or an in-depth coverage of fewer topics. To make room for more topics, I have avoided including a lot of reference material and lengthy listings. For example, you won't find complete project listing or Form descriptions. I assume you can draw a few controls on a Form and don't really need long descriptions of the properties of the controls. I'm also assuming that you don't want to read the trivial segments of each application. Instead, the listings contain the "meaty" part of the applications; the procedures that explain the topic at hand. If you want to see the complete listing, it's all on the CD. Many books offer their readers long, numbered sequences of steps to accomplish something. Following instructions simplifies certain tasks, but programming isn't about following instructions. It's about being creative; it's about being able to apply the same technique in several practical situations. And the way to exploit creatively the power of a language such as Visual Basic is to understand its principles and its programming model and develop a sense of how to apply the language to daily programming situations. Each time I show you how to design an application, I provide a detailed, step-by-step procedure that will help you accomplish the task. But this book goes beyond that. I explain why things must be done in a certain way, and I present alternatives and try to connect new topics to those explained earlier in the book. In several chapters, I expand on applications developed in earlier chapters. Connecting new knowledge to something you have mastered already provides a positive feedback and a deeper understanding of the language. The Structure of the Book This book wasn't meant to be read from cover to cover, and I know that most people don't read computer books this way. Each chapter is independent of the others, although they make references to previous chapters. Each topic is covered in depth; however, I make no assumptions about the reader's knowledge of the topic. As a result, you may find the introductory sections of a chapter too simple. The topics discussed become progressively more advanced, and you will certainly find some new information in every chapter. Even if you are familiar with the aspect of the language discussed in each chapter, take a look at the examples. Some of them are what I would call "advanced." One of my goals was to simplify as many advanced topics as I could and demonstrate them with practical examples. This book tries to teach through examples. Isolated topics are demonstrated with short examples, and at the end of many chapters you will build a large, practical application (a real-world application) that "puts together" the topics and techniques. Some of the more advanced applications may not be so easy to understand, and this is exactly where you shouldn't give up. Simpler applications would have made my (and your) life easier, but the book wouldn't deserve the title Mastering, and your knowledge of Visual Basic wouldn't be as complete. Mastering Visual Basic 5 is organized in four parts. Part I discusses the fundamentals of Visual Basic. It contains two introductory chapters, a reference chapter that discusses the absolute essentials (variables, procedures, and so on), and then moves to the building blocks of the language: Forms and ActiveX controls. The last chapter of the first part discusses graphics methods. Part II is a collection of advanced and nontrivial topics. I discuss a few of the more advanced ActiveX controls, how to add multimedia elements to your applications, and how to write MDI applications. In this part of the book, you will find a chapter that introduces a powerful programming technique, recursive programming. The last chapter in the second part of the book is an introduction to database programming with Visual Basic. Part III discusses ways to extend Visual Basic. You will find an introduction to the Windows API, and you will learn how to build ActiveX components, such as OLE servers and custom ActiveX controls. Part IV deals with the newest in Visual Basic. It discusses various techniques for applying your knowledge of Visual Basic to the Web. In this part of the book, you will learn how to write applications for the Web any how to use custom ActiveX controls on Web pages. A good portion of this chapter deals with VBScript, a variation of Visual Basic you can use to program (or activate, as it's called) your Web pages. How to Reach the Author Despite our best efforts, the first edition of a book this size is bound to contain errors. Although printed media isn't as easy to update as a Web site, I will spare no effort to fix every problem you report (or I discover). If you have any problems with text or the applications in this book or if you have any general questions about Visual Basic, you can contact me directly at: 76470.724@compuserve.com Although I can't promise a response to every question, I will fix any problems in the examples and provide updated versions. I would also like to hear any comments you may have on the book, about the topics you liked or not and how useful you found the examples. You comments will be taken into consideration in future editions.