アプリ版:「スタンプのみでお礼する」機能のリリースについて

教えてください。

VBのコレクション配列はVBSにはあるのでしょうか?
クラスオブジェクトをコレクション配列に入れたいのですが....


例:
Class myclass

:
:

End Class


Sub Main()

dim col as Collection
dim mycl

mycl = new myclass
col = new myClass

for i =0 to max
myclass.xxx = xxxx
col.add i mycl
next

End Sub

以上簡単ですが、myclをコレクション配列に格納したいのですが、

A 回答 (1件)

多分コレクションに該当するのは、Dictionaryオブジェクトだと思います。


例えばこんな感じ
'-----------------------------------------------------------
Class Point
Private PointX,PointY
Public Property Get X()
X=PointX
End Property
Public Property Let X(v)
PointX=v
End Property
Public Property Get Y()
Y=PointY
End Property
Public Property Let Y(v)
PointY=v
End Property
Public Sub Show()
WScript.Echo "("& x & "," & PointY &")"
End Sub
End Class

Dim col
Dim mycl
Dim i

Set col = CreateObject("Scripting.Dictionary")

for i=0 to 10
Set mycl = new Point
mycl.x=i
mycl.y=Int(10 * Rnd)
col.Add i, mycl
next
for i=0 to 10
col.Item(i).Show()
next
    • good
    • 1
この回答へのお礼

ありがとうございました。
うまくいきました。

お礼日時:2005/10/04 09:28

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!