Code Modules

Code modules in Visual Basic work in the same way as they do in VBA. A code module is a container for global methods and properties that can be used by other parts of your application. Unlike classes, you do not need to create a new instance of a module in order to call the methods.

Nor do you need to fully qualify your call unless the same method exists in multiple modules. To fully qualify the method name you would use moduleName.methodName().

Modules are a simple way to create code that can be accessed from anywhere in your application, but in general it is better to use classes and object-oriented techniques. In the next section you will learn about the benefits of object-oriented programming.

0 0

Post a comment