Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

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.

 

 

Sitemap