PDA

View Full Version : Class .. non class


YosSa
31-03-2004, 09:39 AM
What exactly is the difference between a class module and a normal module ?? :?: :?: :arrow:

And when should i use option explicit ?? :evil: :?:

Eddie
31-03-2004, 11:39 PM
8) YosSa...I'll get back to you on this one....I'll send you a PM aswell

YosSa
01-04-2004, 04:44 AM
would be great :lol:

Dont keep me waiting to long ... getting old here :!: :mrgreen:

Eddie
02-04-2004, 12:01 AM
I found this on the net which give a pretty good expalnation of the two.
Hope it helps.

standard module
- A dumping ground for public variables, public enumerations, public types, and public subs/functions
- Code placed here that's not typed as PRIVATE can be accessed from anywhere in your project
- Standard modules do NOT need to be initialized... simply call the functions it contains directly

class module
- These are objects that have to be initialized ( i.e. Set MyVariable = New MyClass )
- These objects have to be cleaned up or terminated once they are no longer needed ( i.e. Set MyVariable = Nothing )
- Class modules automatically call a privately declared sub called "Class_Initialize" (no parameters) whenever they are SET. This allows you to initialize any variables or information related to your class.
- Class modules automatically call a privately declared sub called "Class_Terminate" (no parameters) whenever they are destroyed (set equal to NOTHING). This allows you to clean up any objects, variables, or information related to your class.
- Class modules can be used to maintain "state" when it comes to information relating to your class. This means if you want to set the last accessed date of a property or sub... you can. You can maintain if the class is open, closed, pending, etc. and it remembers that (via Properties).
- Class modules are usually used to encaposlate complex tasks and give you easy interfaces to them