Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just wanted to say that you guys RULE, a million thank you's to whoever created, and/or manages this site. KEEP UP THE GOOD WORK..."

Geography

Where in the world do Tek-Tips members come from?
papadilbert (Programmer)
29 Nov 11 16:32
I coded a simple example of a base class and child class. The base class has one filed and the Let and Get "dummy" properties to maintain it. The implementation of the Let and Get properties are coded in the child class.

The problem is that the child properties are not being executed. Instead, the parent properties are executed.

Here is more detail
 


I have a base class "clsSimple" that defines Private CustomerName as String.

In the base class I coded (abbreviated below):

Private Property Get CustomerName()
'empty
end Property
 
Private Property Let CustomerName()
'empty
end Property

----------------------

The child class is an Access form with a button.

In the child class I coded (abbreviated):

'----- aForm--------------

Implements clsSimple

Private Property Get clsSimple_CustomerName()
...code...
End Property

Private Property Let clsSimple_CustomerName()
...code...
End Property


Private Sub aButton_Click()
 Dim objSim As clsSimple
 Set objSim = New clsSimple

 objSim.CustomerName = "George"

 Set objSim = Nothing

End Sub

-------------

My expectation was that when aButton_Click() is executed, the statement objSim.CustomerName = "George" would execute the Set property of the child class, it being the implementation of the parent property.

Instead, the Set property of the base class is being executed.

Where have I gone wrong?



 
HarleyQuinn (Programmer)
30 Nov 11 5:27
Basic idea of what's wrong is that you're not making a reference to the class that implements clsSimple at all. You're instantiating the clsSimple class and assigning it values directly.

Have a go with:

CODE

Set objSim = New aForm
Step through it and see the properties being set in the class implementing clsSimple.

Hope this helps, if you'd like any further information about what's happening with the implementation don't hesitate to ask.

Hope this helps

Andy
---------------------------------
Zebracorn: 50% Zebra, 50% Unicorn = 100% Real.

http://lessthandot.com  

papadilbert (Programmer)
1 Dec 11 13:06
That is it exactly. I created an instance of the wrong class. DUH.
Thanks for the response!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close