Exposing NEWENUM IUNKNOWN interface from a VBA Class mOdule 
Author Message
 Exposing NEWENUM IUNKNOWN interface from a VBA Class mOdule

Is there anyway to expose the newenum interface from a VBA Class module
the say way it's done in VB6?

I have a collection contained in a class and i would like to expose the
collection add/delete methods so that my class has those functions so i
can do something like

Instance.add someObj

--
Shaun Farrugia
Software Architect
DTE Energy Trading



Sat, 27 Aug 2005 02:54:38 GMT  
 Exposing NEWENUM IUNKNOWN interface from a VBA Class mOdule


Quote:
> Is there anyway to expose the newenum interface from a VBA Class module
> the say way it's done in VB6?

> I have a collection contained in a class and i would like to expose the
> collection add/delete methods so that my class has those functions

Hi,

A common misconception is that enumeration and collections are the same
thing, but it's not so.

Implementing an IEnumVARIANT interface with DISPID_NEWENUM (-4) will allow
people to iterate over your collection using For Each... Next, but it does
not provide a mechanism for adding or removing elements from the collection.

You just need to create the methods "Add" and "Remove" yourself.

See
http://msdn.microsoft.com/library/en-us/vbcon98/html/vbconcreatingyou...
sscollectionthehouseofbricks.asp for more info.

Peter

--
Peter Torr, Microsoft Program Manager
This post is provided "AS IS" with no warranties, and confers no rights
Sample code subject to http://www.microsoft.com/info/cpyright.htm



Sun, 28 Aug 2005 02:42:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How can I create a class that exposes several different NewEnum's

2. Implementing IUnknown interface in Access 2000 class

3. Public Property Get NewEnum() As IUnknown

4. problem with NewEnum method([out, retval] IUnknown** )

5. Class modules (and interfaces) in eVB

6. Class modules 97 - Refering to array within a custom class module

7. Accessing procedures of a class module from another class module

8. Exposing Properties collection in custom classes as many MS Classes do

9. Exposing a Properties collection in custom classes as many MS Classes do

10. Cannot implement interface in VB with IUnknown retval

11. Problem with NewEnum using custom Interface written in IDL

12. Interfaces IUnknown

 

 
Powered by phpBB® Forum Software