Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Creating collections explicitly

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,24008
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Creating collections explicitly
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Creating collections explicitly - 7/25/2005 3:11:28 AM   
  RenzoF

 

Posts: 1
Score: 0
Joined: 7/25/2005
Status: offline
I want to know if there's a way to create a Collection explicitly.

Something like:

Dim myCol

Set myCol = New Server.CreateObject("Collection")
mycol.Add Object

and so on.
 
 
Post #: 1
 
 RE: Creating collections explicitly - 2/17/2006 9:22:26 AM   
  ebgreen


Posts: 4960
Score: 31
Joined: 7/12/2005
Status: offline
Old question, but I will answer it anyway. In vbscript, there is no stand alone collection data type. The functionality of collections is contained in the Array and Dictionary types instead. It would be simple to write a collection class however. I can do that if it would be helpful to anyone.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to RenzoF)
 
 
Post #: 2
 
 RE: Creating collections explicitly - 2/17/2006 9:48:20 AM   
  ebgreen


Posts: 4960
Score: 31
Joined: 7/12/2005
Status: offline
Ok, well I decided to make a collection class of my own just for fun. What Methods/Properties should I give it? So far I can think of:

.Add      - Add an Item to the collection
.Count   - The number of items in the collection
.Items   - Returns an array of the items in the collection for use in a for-next loop.
.GetItem(nIndex) - Returns the Indexth item from the collection

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Creating collections explicitly - 3/30/2006 5:52:28 AM   
  ebgreen


Posts: 4960
Score: 31
Joined: 7/12/2005
Status: offline
Here is the collection class I made. It is far from perfect and I may make changes going forward, but for the time being it gives me basic functionality.


      

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Creating collections explicitly Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts