What is a class module? and what is the difference between it and a regular module?
Printable View
What is a class module? and what is the difference between it and a regular module?
A classmodule is a module that act's as an object that can be used in instances. Classmodules may let you use separate variables for each instance so you will have something like an UDT with code. A regularmodule is like a single instance of a classmodule. All public methods and variables can be used from the classmodule by using the syntax
classinstance.methodname
or
classinstance.variable
Just like you use:
form.print "Hello world"
or
Msgbox form.caption
The big advantage with classmodules are that they keep your data and code at the same place and give you an object oriented interface, that is easy to work with.