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

jwcolby jwcolby at colbyconsulting.com
Fri Apr 15 07:43:58 CDT 2011


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



More information about the AccessD mailing list