PC Review


Reply
Thread Tools Rate Thread

add module vs add class??

 
 
=?Utf-8?B?UmF5?=
Guest
Posts: n/a
 
      20th Feb 2004
Greeting,
I'm still grasping the class concept so bear with me.
I have a vb.net app in which I wrote and placed various public functions for later reference.

In vb.net there is an option to "add class" or "add module". My understanding is a module is a class so what is the difference?

Correct me if I'm wrong....a module allows you to call various functions/procedures without first defining and class you do?
 
Reply With Quote
 
 
 
 
William Ryan eMVP
Guest
Posts: n/a
 
      20th Feb 2004
A module is a class, it's just a sealed (ie, you can't inherit from it) and
it has shared/static members. You can create a class that gives you the
same functionality (in C# modules as such don't exist) so the distinction
isn't really there. If you have a class with all shared members, you never
instantiate it so everything is shared or static. Very handy for some apps,
not quite so useful in others.

If you want to see what's really happening, create a class that's sealed and
mark everything static. Then create a module with the same names. Compile
and look at them through ILDASM...the similarities are remarkable.

HTH,

Bill
"Ray" <(E-Mail Removed)> wrote in message
news:2DFC2FF3-9880-4032-9A98-(E-Mail Removed)...
> Greeting,
> I'm still grasping the class concept so bear with me.
> I have a vb.net app in which I wrote and placed various public functions

for later reference.
>
> In vb.net there is an option to "add class" or "add module". My

understanding is a module is a class so what is the difference?
>
> Correct me if I'm wrong....a module allows you to call various

functions/procedures without first defining and class you do?


 
Reply With Quote
 
=?Utf-8?B?UmF5?=
Guest
Posts: n/a
 
      20th Feb 2004
Thanks for the Reply William.

So it seems that in most cases, one would use add class as oppose to add module.

I'm slowly grasping the concept. From reading other threads there's no performance degregation in using a class vs module.

Since modules don't exist in C#, obviously use class.
But what scenario would I use module in VB as oppose to a Class?

Thanks for educating me!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
running a Sub in a class module from a functionin a general module Paul Microsoft Access Form Coding 2 9th Feb 2010 02:25 AM
Difference between Form's Class Module and Class Module tobesurveyor via AccessMonster.com Microsoft Access VBA Modules 4 14th Apr 2006 01:08 PM
Class Module vs. Module - Philosophical Differences =?Utf-8?B?dnNlYWxl?= Microsoft Access VBA Modules 1 10th Aug 2005 12:29 AM
Convert Class Module to Standard Module =?Utf-8?B?TXVycA==?= Microsoft Access VBA Modules 2 26th Apr 2005 06:33 AM
VB hang when opening a class module (or form module) Antoine Microsoft Access 1 7th Mar 2004 12:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:58 PM.