Can a dictionary object have multiple Items under same key?

后端 未结 4 561
不思量自难忘°
不思量自难忘° 2021-01-19 01:49

I a looking for an workaround related to dictionary objects items

Dim a, d \'Create some variables

 Set d = CreateObject(\"Scripting.Dictionary\")

 d.Add \         


        
4条回答
  •  时光说笑
    2021-01-19 02:15

    Here is another example for any others who view this and need another approach towards this solution. I feel this can be of help.

    Dim objDictionary
    Set objDictionary = CreateObject("Scripting.Dictionary")
        dicKey = 69
        dicValues = ""
        dicVal = "val1"
        dicVal2 = "val2"
        dicVal3 = "val3"
        objDictionary.add dicKey, DicValues1 & DicValues2
        chang = -1
    
    if chang = -1 then  
        objDictionary.item(dicKey) = dicVal & "," & dicVal2
        chang = -69
    end if
    
    if chang = -69 then
        objDictionary.item(dicKey) = dicVal3 & ", " & dicVal & ", " & dicVal2
        chang = -1
    end if
    
    for each objDictionary_key in objDictionary.keys
        msgbox "Key: " & objDictionary_Key & " Value: " & objDictionary.item(objDictionary_Key)
    next 
    

    I hope this helps some!

提交回复
热议问题