Identifying Property Let and Get?

L

Laurie

When building class modules are there any naming standards for Property Let
and Get variables to help users of the object understand which properties
require setting and which are for reading? E.g.

Class Chair

The object may require the property to be read in this example
Public Property Get Height()
Height = vHeight
End Property

The object may require the property to be set in this example
Public Property Let Height (Height As Single)
vHeight = Height
End Property

So, how does the user know what to do with this?

Chair.Height

Is it better to name the property let:

Public Property Let WhatIsHeight (Height As Single)
vHeight = Height
End Property

Thanks
 
R

Rod Gill

There are no standards here, but at the very least add comments at the top
of the class to explain what has to be set. If one of the classes methods
requires a property that hasn't been set, it should return an error or
display a message explaining what needs to be done. With comments and tests
fro required values in properties, there is usually little need for anything
else.

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 
L

Laurie

Thanks for the replay Rod. I intend to compile the class module into a
ActiveX DLL. In this case, it won't be possible for the developer to read any
comments.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top