Hi
I'm trying to introduce an enumerator into a class.
I've introduced a NewEnum routine and set it's procedure attributes to -4.
The collection class wraps a dataset (holding a list of appointmenta) so I'm
populating an Appointment object and returning it via the NewEnum call.
I'm stepping the code and the "For ... Each" is certainly executing as is
the creation of the Appointment. However, when I step off the End Property
of the NewEnum I get an error, RTE 451
"Property let procedure not
defined and property get procedure did not return an object."
What's going on?
Thanks
Simon
PS Alpine --- FWIW, I wondered whether I could get this working without the
need to use the IVBEnumerator stuff of your supercollection class!
Public Property Get NewEnum() As IUnknown
'This function has a Procedure ID of -4, and is hidden
Set NewEnum = Appointment
End Property
Private Property Get Appointment() As CAppointment
Dim l_oAppointment As CAppointment
Set l_oAppointment = New CAppointment
With l_oAppointment
....
End With
Set Appointment = l_oAppointment
End Property
alpine - 26 Aug 2005 05:27 GMT
You need to pass a pointer to an IEnumVARIANT interface as the return
from the NewEnum property. If you are using a standard VB collection
object as the backing for your collection, you should delegate the
call to the collection's NewEnum method which returns the specified
pointer. If your CAppointment object is a collection, you'll need to
delegate to it's NewEnum method to get the correct pointer. Something
like....
Public Property Get NewEnum() As IUnknown
Set NewEnum = Appointment.NewEnum()
End Property
HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
>Hi
>
[quoted text clipped - 37 lines]
>
>End Property