On the Microsoft campus, you sometimes see employees sporting T-shirts that advertise a mythical product called Object Basic. Not every Microsoft product that reaches the T-shirt stage reaches the product stage, at least not under the same name; just ask a Microsoft old-timer about Cirrus or Opus or Cashmere. In a larger sense, however, Visual Basic has become Object Basic, regardless of the name the marketing department puts on the box.
Object Basic has been on the horizon for a long time, and it still has a way to go. But, starting in version 4, objects became more than an afterthought, and they continued their march toward objectness in version 5—although not at a fast enough pace to suit me. Form modules provide a way to create visual objects with properties and methods, and class modules provide a way to create your own nonvisual objects. Controls, forms, classes, the Data Access Object—all can be created with Dim, assigned with Set, manipulated with properties and methods, and grouped in collections.
Objects are more than a new feature; they’re a way of thinking. Objects can help you make your code more modular, and you can make your objects available to any program that understands COM Automation. In other words, your objects can be used by programs written in Visual Basic, by programs written in most versions of C and C++, and by macros in many applications, including Microsoft Word, Microsoft Excel, and the Visual Basic environment itself.
This chapter (and the rest of the book) preaches the object religion. From here on out, we’ll be talking about Object Basic not as a product but as an attitude, a state of mind. By the time you finish, you’ll be telling your children to change their methods and properties or face Punishment events. You’ll go into a restaurant and ask your waitperson to create a Hamburger object and set its Tomato and Onion properties to True but set its Mustard property to False. You’ll write your representatives letters demanding fewer Tax events and more Service methods. For Each friend in your Friends collection, the friend will call the Wish method with the named argument NeverSeenThisBook:=True.