I'm providing this as a quote from the VB Help pages titled "Putting Property Procedures to Work for You":
"Read-Write Properties
The following code fragment shows a typical read-write property:
' Private storage for property value.
Private mintNumberOfTeeth As Integer
Public Property Get NumberOfTeeth() As Integer
NumberOfTeeth = mintNumberOfTeeth
End Property
Public Property Let NumberOfTeeth(ByVal NewValue _
As Integer)
' (Code to validate property value omitted.)
mintNumberOfTeeth = NewValue
End Property
The name of the private variable that stores the property value is made up of a scope prefix (m) that identifies it as a module-level variable; a type prefix (int); and a name (NumberOfTeeth). Using the same name as the property serves as a reminder that the variable and the property are related.
As you've no doubt noticed, here and in earlier examples,
the names of the property procedures that make up a read-write property must be the same."
OK, so here's a snippet of my code in my class module:
CODE
Private mPromoterID As Integer
Public Property Let PromoterID(tpromoterid As Integer)
mPromoterID = tpromoterid
End Property
Public Property Get PromoterID()
PromoterID = mPromoterID
End Property
My property procedures have a common name, "PromoterID". But when I go to execute the project, I receive the following "Compile Error" and highlights the "Let" procedure:
"Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalid Set final parameter"
When I give the two procedures a unique name like below, it compiles and executes just fine.
CODE
Private mPromoterID As Integer
Public Property Let lPromoterID(tpromoterid As Integer)
mPromoterID = tpromoterid
End Property
Public Property Get gPromoterID()
gPromoterID = mPromoterID
End Property
Why can't I give these two procedures a common name? I see examples ALL THE TIME where Get and Let procedures have common names. Why can't mine be so ?
Thanks!
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.