Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / August 2005



Tip: Looking for answers? Try searching our database.

NewEnum Q again

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon Woods - 25 Aug 2005 18:59 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.