Sunday, August 2, 2009

Why use VB modules?

I'm a C# programmer, learning some VB.NET...





I'm curious as to the usage of "modules". Why would somebody prefer a module over a class with shared members? Functionally they're the same, and in code they're practically the same except that using a class makes the code legible, rather than a jumble of routines from random modules of code.





Aren't modules an archaic feature from pre-.NET days? Why do they still exist?

Why use VB modules?
Modules are application level classes. In other words, to use a shared class, you have to type in VB:





MySharedClass.MySharedSubOrFunction





Where as Module, you can just type MySharedSubOrFunction





See the difference?


No comments:

Post a Comment