
Q: Code Module vs UserControl (Form, Class) module.
Typically, you are correct. One should try to incapsulate as much as
possible.
However, there are two advanatages to using std code modules.
1) Should you require global data, you can only put it in a std code module.
This allows you, for example, to have many controls access the same database
connection.
In essence, this is a common way to have data exposed which is "sharable" by
multiple instances of classes or controls.
2) This also gives you a convenient way to handle callback functions. The
AddressOf operator will only work with functions specified in std code
modules. This is kind of a safety-net since the address of global functions
don't change as long as the DLL's image is valid.
-Rob
Quote:
>Hi all,
> I've seen a number of code samples where the developer puts the
>majority of their code into a regular code module and then have their
>UserControl (Form, Class) call into that module.
> Does anyone know if there is there any benefit to programming this
>way? I haven't seen any documentation indicating pro/cons for it.
>Currently I am putting all the code into its related UserControl.
> Is there some memory/performance issue around this?
>TIA!
>--
>Chris