home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / EliteXp®_P21651610152009.psc / BoundImports.cls < prev    next >
Text File  |  2009-10-15  |  2KB  |  86 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "BoundImports"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
  15. Attribute VB_Ext_KEY = "Collection" ,"BoundImport"
  16. Attribute VB_Ext_KEY = "Member0" ,"BoundImport"
  17. Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
  18. 'local variable to hold collection
  19. Private mCol As Collection
  20. Dim fOwner As PE
  21. Friend Sub SetOwner(cOwner As PE)
  22. Set fOwner = cOwner
  23. End Sub
  24. Friend Property Get Owner() As PE
  25. Set Owner = fOwner
  26. End Property
  27.  
  28. Public Function Add(BoundImport As BoundImport, Optional ByVal Key As String) As BoundImport
  29. If Key <> "" Then
  30.     mCol.Add BoundImport, Key
  31. Else
  32.     mCol.Add BoundImport
  33. End If
  34.  
  35. End Function
  36.  
  37. Public Property Get Item(Index) As BoundImport
  38. Attribute Item.VB_UserMemId = 0
  39.     'used when referencing an element in the collection
  40.     'vntIndexKey contains either the Index or Key to the collection,
  41.     'this is why it is declared as a Variant
  42.     'Syntax: Set foo = x.Item(xyz) or Set foo = x.Item(5)
  43.   Set Item = mCol(Index)
  44. End Property
  45.  
  46.  
  47.  
  48. Public Property Get Count() As Long
  49.     'used when retrieving the number of elements in the
  50.     'collection. Syntax: Debug.Print x.Count
  51.     Count = mCol.Count
  52. End Property
  53.  
  54.  
  55. Public Sub Remove(Index)
  56.     'used when removing an element from the collection
  57.     'vntIndexKey contains either the Index or Key, which is why
  58.     'it is declared as a Variant
  59.     'Syntax: x.Remove(xyz)
  60.  
  61.  
  62.     mCol.Remove Index
  63. End Sub
  64.  
  65.  
  66. Public Property Get NewEnum() As IUnknown
  67. Attribute NewEnum.VB_UserMemId = -4
  68. Attribute NewEnum.VB_MemberFlags = "40"
  69.     'this property allows you to enumerate
  70.     'this collection with the For...Each syntax
  71.     Set NewEnum = mCol.[_NewEnum]
  72. End Property
  73.  
  74.  
  75. Private Sub Class_Initialize()
  76.     'creates the collection when this class is created
  77.     Set mCol = New Collection
  78. End Sub
  79.  
  80.  
  81. Private Sub Class_Terminate()
  82.     'destroys collection when this class is terminated
  83.     Set mCol = Nothing
  84. End Sub
  85.  
  86.