Always use dictionary’s however can you set more than one value to a value?
Something like this?
dim di as new dictionary
di.value(“one”).name = “john smith”
di.value(“one”).age= 24
di.value(“one”).country= “Australia”
Thanks
Damon
Always use dictionary’s however can you set more than one value to a value?
Something like this?
dim di as new dictionary
di.value(“one”).name = “john smith”
di.value(“one”).age= 24
di.value(“one”).country= “Australia”
Thanks
Damon
No, but you can create a class with the properties you want, then assign instances of those to the Dictionary.
Or, use a Dictionary within a Dictionary:
dim di as new dictionary
Dim innerdict As New Dictionary
innerdict .value("name").name = "john smith"
innerdict .value("age").age= 24
innerdict .value("country").country= "Australia"
di.Value("one") = innerdict
To get data out just reverse the process:
dim di as new dictionary
Dim innerdict As Dictionary = di.Lookup("one", Nil)
If innerdict <> Nil Then
MsgBox(innerdict.Value("name")
End If
Can’t edit. Should have been:
innerdict.value("name") = "john smith"
innerdict.value("age")= 24
innerdict.value("country")= "Australia"
Interesting all.
this works fine for me : test has two property’s name and age
[code] dim c as new test
dim di as new Dictionary
c.name=“damon”
c.age=44
di.Value(“one”) = c
c= new test
c.name=“Kem”
c.age=34
di.Value(“two”) = c[/code]
if you don’t put c = new test then the last values appear in both “one” and “two”
Many thanks
Damon