Results 1 to 6 of 6

Thread: Collections [resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Arrow Collections [resolved]

    Ok I fell kinda dumb asking this but here goes.

    back in vb 6 to make a collection of objects I would just
    Code:
    Dim cObjs As Collection
    
    cObjs.Add(mObj)
    now I looked at Implementing ICollection and a Hashtable and a Storedlist and well it makes since but I don't ( I feel slow because I bet it works the same) see any example of throwing an object into the collection just use numbers or what not...

    here is why I feel dumb by the way I wrote this reusable collection class about 2 months ago when I was making some COM object or another and wll I thought I had collections down pat....

    it doesn't support remove but i didn't need remove

    it's for implementing stuff like
    Code:
    class.objs(1).doSomething
    class.objs(1).objs.doSomething
    Code:
    Option Explicit
    Private mObjs As New Collection
    
    Friend Function Add(ByRef obj As Variant, Optional iName As String = "Internal Name")
        Dim sName As String
        If iName = "Internal Name" Then
            sName = mObjs.Count + 1
        Else
            sName = iName
        End If
        mObjs.Add obj, sName
    End Function
    
    Public Function NewEnum() As IUnknown
       Set NewEnum = mObjs.[_NewEnum]
    End Function
    
    Public Property Get Count() As Integer
        Count = mObjs.Count
    End Property
    
    Public Property Get Child(ByVal Index As Variant) As Variant
        Set Child = mObjs(Index)
    End Property
    so anyway i feel dumb please explain it to me....
    Last edited by Magiaus; Apr 9th, 2002 at 10:50 AM.
    Magiaus

    If I helped give me some points.

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