i have a dictionary that looks something like this
keyA, (values(), values(), values())
keyB, (value())
KeyC, (values(), values(), values())
Where each value is an array of strings.
This is my method to add an entry into the dictionary:
Sub AddToResults(ID As String, data() as String)
dim arr() as String
if Results.HasKey(ID) then
arr = Results.Value(ID)
arr.Append(data) /// This line causes an exception to be raised.
Results.Value(ID) = arr
else
Results.Value(ID) = data
end if
End Sub
The elements of arr are Strings, while data() is an ‘array of strings’ which is not a String so can’t be added to arr.
For an array of arrays you need to use a Variant array. This is how I’d write it… (untested)
Sub AddToResults(ID As String, data() as String)
if Results.HasKey(ID) then
dim arr() as Variant = Results.Value(ID)
arr.Append(data)
//Results.Value(ID) = arr //not necessary
else
dim arr() as Variant
arr.Append(data)
Results.Value(ID) = arr
end if
End Sub