devxlogo

Make Collections Work Like Standard VB Collections

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)

See also  Comparing different methods of testing your Infrastructure-as-Code
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist