Sunday, September 10, 2006

Standard Module VS Class Module

I was doing my normal coding and was brought to think about it. I found two articles which explains it all...


MSDN


MSDN2


To put it in another way;


Standard modules are usually used to cosolidate related procedures into a single block of code.

Class modules are usually used to encapsulate blocks of code and make it available through the standard object-oriented methodologies:  Properties (public variables and related validation), Methods (functions and prcedures), and Events.

--
Typical Standard module will contain a lot of these:

Public Sub xxx()
...
End Sub

Public Function yyy() As datatype
...
End Function

--
Typical Class module will contain a lot of these:

Public Property GET xxx()
...
End Property
Public Property SET xxx()
...
End Property

Public Sub xxx()
...
End Sub

Public Function yyy() As datatype
...
End Function

Public Event zzz

...
RaiseEvent zzz
...


Your Ad Here