Dear John, How Do I... Create All My Objects in External ActiveX Components?

You don't have to! There's a lot of hype and interest and great reasons to create and use objects in ActiveX components, but an excellent way to get started creating your own objects is to simply add class modules to your Standard EXE Visual Basic projects.

Objects defined by class modules within your project are automatically private to your application. (If you want to let other applications create instances of your objects, well then, we're back to talking about ActiveX components.) Your application can create one or multiple instances of each class module-defined object, and each copy has its own set of data. One of the advantages of these objects is that the memory used by each instance is recovered immediately when the object is destroyed. Probably the biggest advantage, however, is the increased structure, understandability, and organization that OOP techniques bring to your programming efforts. Getting rid of Basic's line numbers a few years back was a huge step in the right direction, and the addition of objects is another quantum leap.

The next two sections provide a relatively simple example of an object created in a Standard EXE project. This is the simplest way to start working with objects.