Dear John, How Do I... Use Friend Methods?

Visual Basic 4 first introduced us to class module-defined objects and their methods and properties. Users soon noted a minor shortcoming in the way a component exposes properties and methods of its set of class modules to client applications. There was no way for a class to expose methods to other objects within the same component without also exposing these methods to the whole world.

Visual Basic solved this problem by providing the Friend keyword, which modifies a method so that it is exposed and visible to all classes within the same component but not to external, client applications.

Components often provide a related set of objects that have a lot in common with each other. The Friend methods let these objects communicate in a structured way among themselves, without requiring their intercommunication methods to be exposed to other applications.