the differences between Classmodule & Module

iwant to know more informations about Classmodule & Module ihope that the answers with examples ,so as to help me to understand.

thanks for everybody.
HowidaElrasheedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

caraf_gCommented:
A bit much to ask... this is one of the major aspects of later versions of VB and it takes a manual to explain it properly. Not something that can be done easily in an EE thread.

Check out the VB help for starters, and if you're really serious about learning, go to your local book shop and check out the computers section. There are some good VB books about.
0
vbyuvalCommented:
I think the major difference between CalssModule and Module is that with CalssModule you can use the procedurs with other programs for example :
With VB you can use som Microsoft Word's fonctions that because the function has writen in CalssModule if they where in Module you couldn't use them .

Of corse there are many more thinks you should know about CalssModule but as Caraf_q said it's too large thing to here .

                          Enjoy
                        Yuval Amir
0
caraf_gCommented:
Thanks vbyuval,

Oh, yes, my profile is caraf_g. It's the EE font that makes it look like caraf q.
0
HyperCubeCommented:
A module is like a toolbox : you put in variables and functions that will be available to any code to which the module is visible.

A class module is a blueprint for an object : usually, some user-defined data type and all the functions needed to access and work on that data. Only the functions and variables that are Public can be seen from outside the object.

For instance, if you have a class named clsPerson that defines a person, you might have something like:

private intAge as integer
private strName as string
private strAddress as string

Public Property Get Age() as integer
    Age = intAge
end Property

Public Property Let Age(intNewAge as integer)
    if intNewAge < 125 then
        intAge = intNewAge
    end if
End Property

Public Function Talk() as string
    Talk = "Hello there."
End Sub

.... ans so on.

The idea here is that you can have several persons with different information, but they have the same type of information, and the validation is directly tied to the data.

So you can do something like :

Dim Bob as New clsPerson
Dim Bill as New clsPerson

Bob.Age = 33

Bill.Age = 21

Debug.Print Bill.Talk

but you can't do this :

Bill.intAge = 33

because intAge is private.

So each Instance (or distinct object) corresponds to the definition (Class).

And you can protect the variables from irrelevant value by validating the input.

As was mentioned in previous answers, object-oriented programming is quite an elaborate subject. This is barely scratching the surface.

I hope it helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.