what should be the parameter for create object
the following code
dim a
set a=CreateObject("Collection") //getting a runtime error saying ActiveX
//component can't create object: 'Collection
a.add(CreateObject("Collection"))
a.Items(0).Add(1)
MsgBox(a.Items(0).count)
MsgBox(a.Items(0).Item(0))
When you want to use a COM object in a VBScript file, you need to create an instance of, or instantiate, that object. Instantiating a COM object is a two-part process that uses either the CreateObject or GetObject function and the Set statement. where "Scripting. FileSystemObject" is the ProgID of the FSO object.
A set is a collection of objects. The objects are called the elements of the set. If a set has finitely many elements, it is a finite set, otherwise it is an infinite set.
VB.NET implements a special object called the Collection object that acts as a container for objects of all types. In fact, Collection objects can hold other objects, as well as nonobject data. In some ways, the Collection object is an object-oriented version of the Visual Basic array.
You can use the Visual Basic Collection class to access a collection item by using either a numeric index or a String key. You can add items to a collection object either with or without specifying a key. If you add an item without a key, you must use its numeric index to access it.
how about a Dictionary
Set coll = CreateObject("Scripting.Dictionary")
coll.Add 0, "5"
coll.Add 4, "10"
coll.Add "textkey", "15"
MsgBox coll.Count
MsgBox coll.Item(0)
MsgBox coll.Item(4)
wholeColl = ""
for each key in coll.Keys
wholeColl = wholeColl & key & " = " & coll.Item(key) & ", "
next
MsgBox wholeColl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With