Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Mar 27, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Make Collections Work Like Standard VB Collections

Add the following procedure to your collection object:
Public Function Item(ByVal Value as Variant) _
as SomeObject

  Set Item = mCollection.Item(Value)
  'mCollection is your private module level
  'collection object.

End Function

Now, make the Item procedure default with the Procedure Attributes dialog box. Open the dialog box from the Tools menu, click the Advanced button, and set the Procedure ID to (Default). Now, instead of accessing objects in your collection like this:
  Set objSomeObject = objSomeObjects.Item(1)

You can do this:
  Set objSomeObject = objSomeObjects(1)
Calvin Walker
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date