开发者

vbscript dictonary problem

I am using dictonary in VBscript. I have some problems that I don't understand some of the behaviour:

Dim CmdData  
Set Cm开发者_StackOverflowdData = CreateObject("System.Dictonary")  
CmdData.Add "11", "tttzz"  
CmdData.Add "sssid", "KRN"  
WScript.Echo(" ZZZZZZZZ= " & CmdData.Count)  'It prints zero and not 2

Dim s  
s = CmdData.Item("11")  
alert(s)  
WScript.Echo(s)   'It prints empry box and not tttzz

Dim a, j   
a = CmdData.Keys  
For j = 0 To CmdData.Count -1  
    WScript.Echo(" ZZZZZZZZ= " & CmdData.Count)   
    WScript.Echo(a(j)) ' doesn not print  
Next  

If (CmdData.Exists("-ad")) Then   
    'WScript.Echo (" RR ") ' It prints it although not in the dictonary  
End If  

Thanks


VBScript's Dictionary is "Scripting.Dictionary":

>> set syd = CreateObject("System.Dictionary")
>> syd.add "a",1
>>
Error Number:       429
Error Description:  ActiveX component can't create object
>> set scd = CreateObject("Scripting.Dictionary")
>> scd.add "a",1
>> WScript.Echo scd.Count, scd("a")
>>
1 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜