I would like tu update an entry in a dictionary, but I have problem to find a solution.
I don’t understood way therei is not a system funtion ready to use…
BTW I have create a routine to seatch and modify an entry, but do not work, loop indefinitely.
this is the code:
Function DictUpdateValue(aDict as Dictionary, theKey as Variant, theNewValue as Variant) As int
eger
//Given an Dictionary aDict
// search for key thekey
// update the correspnding value using thenewValue
For Each entry As DictionaryEntry In aDict
If entry.Key.Equals(theKey) Then
aDict.Value(theKey) = theNewValue
End If
Next
Return 0
End Function
Function DictUpdateValue(aDict As Dictionary, theKey As Variant, theNewValue As Variant) As Integer
' Check for existing key
If aDict.HasKey(theKey) Then
' Key found, update value
aDict.Value(theKey) = theNewValue
End If
End Function
I have investigate…
and found that the key was not build exactly the same in the build time and in the search/update time, the different was a space at the end
Solved!
Thank you