[AccessD] First real stumble with using VB.Net over VB

jwcolby jwcolby at colbyconsulting.com
Fri Apr 15 14:26:20 CDT 2011


So what you are saying (and I have no reason to disbelieve this) is that a public variable is a 
private variable wrapped in an invisible property call.

If that is truly the case (and they are identical) then why does he see value / property differences?

And everything that I said below stands.  A variable (field when placed in a class) is a structure 
on the heap (apparently then wrapped in something to return the value to make it public), whereas a 
property is a keyword and a real function which can contain other stuff and does not contain any 
storage of it's own.  I defy you to show me a variable running code to wipe your disk, but I can do 
so with a property.

They are *not* the same thing.  The fact that a public class variable "kinda sorta" emulates a 
private variable with a property wrapper does not make it a private variable with a real property 
returning the value.

I truly don't give a rat's patuty if you or Drew wants to call a public variable a property. 
Apparently Drew desperately wants to do so - reason unknown.  As I am not a VB6 person I have no 
vested interest either way, I am just pointing out the quite obvious problem with trying to apply 
the same name to two objects that perform quite differently and have quite different capabilities. 
I use properties and I often times have code in them which performs calculations or tests.  I have 
never managed to do that with a variable of any kind.  I have had properties which did not wrap a 
variable at all.

A property (keyword / function) does not have any specific storage assigned to it unless you do so, 
intentionally, with more code.  A variable ALWAYS has storage assigned on the stack / heap.

Call both whatever you want, just please do not attempt to tell me that they are the same thing, 
they clearly are not.

I will continue to call variables in a class a field and I will continue to call properties (keyword 
/ function) a property.  Everybody except Drew will understand me.

John W. Colby
www.ColbyConsulting.com

On 4/15/2011 10:26 AM, Shamil Salakhetdinov wrote:
> Hi John --
>
> Public class modules variables are implemented in VB6 and VBA the same way
> as properties IOW they have the same programmatic interface from VB6/VBA
> (and COM) internals point of view. - this is what Drew has been telling
> about here...
>
> Thank you.
>
> --
> Shamil
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: 15 ?????? 2011 ?. 16:44
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] First real stumble with using VB.Net over VB
>
> Drew,
>
> I can't show you documentation but what I can do is show you that a property
> is a function of sorts.
>    It has an entry point on the stack, it accepts a parameter, it returns a
> value.  It has a keyword in the VB language.  It can run any amount of code
> inside of the "function", and do anything that is legal for a function to do
> including dimensioning, reading and writing other variables, running loops,
> doing if then / select case etc., reading and writing to the disk,
> downloading files from the internet, formatting your hard disk... you name
> it.
>
> A property is a function.  It happens to be targeted to wrapping variables
> and exposing them to the outside world but that is not all it can do.  A
> property does not *define* the variable, that is done in the dimension
> statement.  A property does not "own" the variable that it wraps, it is
> simply
> *returning* the variable.  A property does not have any data storage area on
> the heap unless it happens to dimension its own variables inside of the
> property, and even then (except for strings and
> statics) most variables inside of functions are stored on the stack.
>
> A variable, whether global or private is nothing more than a reserved area
> of memory on the heap sized to accept a specific data type.
>
> A variable is not a property, as you can now plainly see from the
> explanation above of what a property is and what a variable is.  How can you
> possibly expect them to be or work the same.  They are different things
> entirely.  The fact that the IDE displays the same icon is unfortunate (for
> you) because it causes you to have false expectations.
>
> Stop arguing about it and accept the reality.  I didn't make the language, I
> just look at what things are and use them appropriately.
>
> John W. Colby
> www.ColbyConsulting.com
>
> On 4/14/2011 3:43 PM, Drew Wutka wrote:
>> Well VBA is a subset of VB 6.  Can you show me any documentation where
>> it defines a Public statement as setting a 'field' to a class, versus
>> Property statement setting a property, in VBA?  When in the IDE, if
>> you have Public MyValue or Property Get MyOther value, both will show
>> up with the same 'property' icon in the IDE.  No declaration that
> 'MyValue'
>> (in this case) is a 'field' in the Object browser.
>>
>> In .Net, it DOES have a different icon in the IDE.  Fields and
>> Properties are given completely different icons in autosensing drop
>> downs.  It makes a clear distinction.
>>
>> Drew
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list