我是一个非VB6的人,不幸的是继承了VB6 / Classic ASP项目.有一个部分,大量的条目被放入一个字典,我想看到它包含的所有内容.我试过这个(oParams是一个字典):
Dim o As Object Dim sDicTempAggr As String sDicTempAggr = "" For Each o In oParams sDicTempAggr = sDicTempAggr & "," & o Next
其中返回:
Object doesn’t support this property or method : 438
使用Option Explicit,我如何迭代VB6字典来查找它包含的一切?
这是一个迭代的示例,如果您仍然有一个问题,请查看第二个循环来检查字典中值的类型
Dim oParams As New Dictionary oParams.Add 1,"This" oParams.Add 2,"That" oParams.Add 3,"The other" Dim key As Variant Dim sDicTempAggr As String Dim sTypes As String For Each key In oParams.Keys sDicTempAggr = sDicTempAggr & IIf(sDicTempAggr <> "",","") & oParams(key) Next key For Each key In oParams.Keys sTypes = sTypes & IIf(sTypes <> "","") & TypeName(oParams(key)) Next key