【发布时间】:2017-08-10 19:50:39
【问题描述】:
' CDays
Private pZone As New Collection
Public Property Get Zone() As Collection
Set Zone = pZone
End Property
Public Property Let Zone(Value As Variant)
For Each element In Value
pZone.Add element
Next
End Property
和子有
' Main Sub
dy.Zone.item("Zone1")(5) = 0
其中 dy 是一个实例 "Zone1" 设置为下面 Item1 的键
然而,这不会改变 Item(5) 中的值。为什么?
【问题讨论】:
-
很难将您提供的代码与本地工具窗口屏幕截图相关联。您能否制作一个实际的minimal reproducible example(强调完成)以便我们尝试重现问题?
-
集合不支持您尝试执行的操作。见:stackoverflow.com/questions/29541710/…
-
如果您想使用字符串作为键访问项目并编辑项目,您可能需要一个脚本字典