How do I replace values in a Hashtable?

I am trying to overwrite a value in a hash table. If the key already exists (using contains) I traverse through the table until I find that key, then set its value to the new value..Can I actually do entry.Value=aValue;??

I am currently doing the following but the Hashtable doesnt seem to get updated although the entry.Value seems to display correctly.

if (analyticsData.ContainsKey(eventString))
{
    for (var entry : DictionaryEntry in analyticsData) 
    {
        if(entry.Key==eventString)
        {
            DebugConsole.Log("KeyAlready exists in table. Replacing value with "+aValue ,Color.cyan);

            //THIS DOESNT SEEM TO BE CHANGING THE ACTUAL ENTRY!!!
            entry.Value=aValue;
            DebugConsole.Log("Entry value is now "+entry.Value);
        }
    }
}
else
{
    analyticsData.Add(eventString,aValue);
}

You can just modify a Hashtable entry using the [] operator, e.g.:

analyticsData[eventString] = aValue;