Setting default property values

dbarasch

New member
Local time
Yesterday, 22:20
Joined
May 8, 2010
Messages
6
I am wondering if there is a way to set default values for specific properties upon instantiating a class.

For example: Suppose I develop a Person class, which has name, address, city, state and zip as properties.

Now when I use the New keyword in my code to instantiate this class, at that time I want to set default values for my properties. I know this can be done in VB.NET. Not sure about in VBA.
 
You would specify what those values where in class' initialize event.
They would then be available in the property calls which retrieved them.
(As you point out - in VBA you can't declare and define the value of a variable at once. The class offers a way to determine initial values, that don't even need to be constant - as the procedre would allow you to determine or calculate those default values in some way).

Cheers.
 

Users who are viewing this thread

Back
Top Bottom