gpt4 book ai didi

collections - 如何在vbscript中创建集合对象?

转载 作者:行者123 更新时间:2023-12-04 05:21:40 25 4
gpt4 key购买 nike

以下代码的create object应该是什么参数

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))

最佳答案

字典怎么样

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

关于collections - 如何在vbscript中创建集合对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2864499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com