Any time a calling routine reference a property in a way that will read the
value from the property, the Get routine fires. So, if you do this:
MsgBox(myObj.LastName)
it will fire the Get routine (because the value is being "read"). On the
other hand, whenever you "set" a property value, the Set routine is run. So
if you do this:
myObj.LastName = "Smith"
it will fire the Set routine.
The line of code you have in the Get statement (LastName=mstrLastName) just
results in the property doing what a programmer would expect a property to
do when he/she references it (namely, return the value "stored there").
But, you don't have to do this - and furthermore, you can do anything else
you like here. For instance, you could count the number of times a property
is read (I have no idea why anyone would want to count such a thing, but
it's just an example so cut me some slack). If you did something like this
you would increment a numeric variable in the Get routine.
I hope this answers your question,
Eric
"Stephen Martinelli" <st*****@johnstontrading.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Im not sure it this is the right newsgroup but.......can someone expain to
me when the get statement fires in a property procedure.
Example
Property lastname as string
Get
LastName=mstrLastName
End Get
Set(ByVal Value as String)
mstrLastName = Value
End Set
End Property
When i remark out the assignment within the get statement, the programs
still executes
Help
Steve