Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2513
  • Last Modified:

Collection objects in VBScript

Hello
I am used to writing web applications using Java, php but not VBScript and ASP.... however I have inherited a legacy system that requires that I use VBScript....
I was wondering whether vbscript has any collection objects that can be resized at runtime, like linked list, vectors or arrayList in java.

thanks
0
lz7cjc
Asked:
lz7cjc
  • 2
1 Solution
 
sybeCommented:
Set MyDictionary = Server.CreateObject("Scripting.Dictionary")


0
 
YZlatCommented:
VBScript has a collection object.

check this out:
http://www.webgecko.com/products/apgen/docs.asp?page=objcollection.htm
0
 
YZlatCommented:
0
 
deighcCommented:
VBScript DOESN'T have a collection object.

It can access collections that come from other objects but you can't create them in VBScript itself.

@YZlat, your first link is documentation for Active Page Generator - they just have examples in VBScript. Your second example shows how to create a collection in Visual Basic and access it in VBScript. And your third example just lists collection properties that come out of other objects (the file system object for example).

There is no way you can create a collection object in VBScript.

@Sybe's example using a Dictionary object is the closest thing you get in VBScript. In practice, it behaves very similarly.

Your only other option for grouping objects together is in an array (but these have to be explicitly re-sized in VBScript - you can't just wantonly increase it's size by adding new items, as you no doubt already know).
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now