Re: Properties that return Objects

From: Bob Butler (tiredofit_at_nospam.com)
Date: 10/27/04


Date: Wed, 27 Oct 2004 09:39:37 -0700


"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:uEmd%23%23DvEHA.2016@TK2MSFTNGP15.phx.gbl
> Bob Butler wrote:
>>
>> Public Property Let C2Ref(ByVal NewC2Ref As Class2)
>> moC2Ref = NewC2Ref
>> End Property
>
> Minor mod... (if I'm not overlooking something)
>
> Public Property Set C2Ref(ByVal NewC2Ref As Class2)
> Set moC2Ref = NewC2Ref

You aren't overlooking anything... I used an old code generator to create
the property procedures and that's a bug that I've never taken the time to
go back and fix. Since I was never calling the Property Let I didn't run
into the error. BTW, it is also valid to use this:
 Public Property Let C2Ref(ByVal NewC2Ref As Class2)
 Set moC2Ref = NewC2Ref
 End Property

That allows you to set the object without using the Set keyword as in
   oC1.C2Ref = New Class2
Whether or not that's a good option to allow may be debatable but it works.