Naming Properties, Methods, and Events

See Also

The properties, methods, and events you add to a class module define the interface that will be used to manipulate objects created from the class. When naming these elements, and their arguments, you may find it helpful to follow a few simple rules.

Note   While it’s possible to use an underscore character in a property name, an underscore in an event name will cause an error. The underscore character is used in Event procedures to separate the event name from the object name. For this reason, it’s best to avoid the underscore character altogether when naming properties, methods, and events.

One of the chief benefits of programming with objects is code reuse. Following the rules above, which are part of the ActiveX guidelines for interfaces, makes it easier to remember the names and purposes of properties, methods, and events.

For More Information   If you have the Professional or Enterprise Edition of Visual Basic, see the expanded list in "What's In a Name?" in "General Principles of Component Design" in Creating ActiveX Components in the Component Tools Guide.