VBA-tools / VBA-Dictionary

Drop-in replacement for Scripting.Dictionary on Mac
MIT License
356 stars 89 forks source link

How to use the added items in the collection into the dictionary #25

Closed nectorprime closed 4 years ago

nectorprime commented 5 years ago

Hi

I want to add the items in the collection and then use them in the dictionary to make one json string see the code:

Option Compare Database
Option Explicit
Private Sub Command0_Click()
Dim foo As New Dictionary
Set foo = New Dictionary
Dim hoo As New Collection
Set hoo = New Collection

    With foo
        .Add "Customer Name", Me.txtchris   'No key. This item can only be retrieved by index.
        .Add "Address", Me.txtAddress  'Key given. Can be retrieved by key or index.
        .Add "Location", Noor

    End With

    Dim member As Variant
    For Each member In foo

    Next

End Sub

Example:

{"a":"aa",
"b":"bb"
"c":[
{"d":"dd",
"e":"ee",
"f":[
1,
2,
]
"k":"kk",
"l":"l"
"m":"mm"
}
nectorprime commented 4 years ago

Done