Results 1 to 2 of 2

Thread: Collection Wrapper NewEnum Error **Resolved**

Threaded View

  1. #1

    Thread Starter
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141

    Collection Wrapper NewEnum Error **Resolved**

    I cannot figure out what is going on here. I can use For Each to iterate through 2 of my classes (Application and Group), but not the other 1 (Section).
    Here is the code in my class Application
    VB Code:
    1. Public Function Sections(Index) As Section
    2.     Set Sections = mCol.Item(Index)
    3. End Function
    4.  
    5. Public Function NewEnum() As IUnknown
    6.     'Set procedure Id to -4
    7.     Set NewEnum = mCol.[_NewEnum]
    8. End Function
    Here is Section Class
    VB Code:
    1. Public Function Groups(Index) As Groups
    2.     Set Groups = mCol.Item(Index)
    3. End Function
    4.  
    5. Public Function NewEnum() As IUnknown
    6.     'Set procedure Id to -4
    7.     Set NewEnum = mCol.[_NewEnum]
    8. End Function
    Here is Group Class
    VB Code:
    1. Public Function Questions(Index) As Questions
    2.     Set Questions = mCol.Item(Index)
    3. End Function
    4.  
    5. Public Function NewEnum() As IUnknown
    6.     'Set procedure Id to -4
    7.     Set NewEnum = mCol.[_NewEnum]
    8. End Function

    When I iterate through the Sections in Application and Questions in Group it works fine, but when I iterate through the Groups in Sections, I get the error Object Required
    VB Code:
    1. Dim a As New Application
    2. Dim s As New Section
    3. Dim g As New Group
    4. Dim q As New Question
    5. a.ID = 1
    6. For Each s In a
    7.     MsgBox a.Title
    8. Next
    9. s.ID = 1
    10. For Each g In s
    11.     MsgBox g.Description
    12. Next
    13. g.ID = 1
    14. For Each q In g
    15.     MsgBox q.ControlType
    16. Next
    Last edited by blindlizard; Mar 24th, 2003 at 03:59 PM.
    I drink to make other people more interesting!
    [vbcode]On Error GoTo Bar[/vbcode]
    http://www.monsterlizard.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width