Stan,
What I normally do is make the "key" read-only on the object being contained
which prevents this problem in the first place.
When I do have objects that the "key" can change, I normally have the object
being contained raise an event when the "key" changes. The collection
handles this event and does as Herfried suggests, removes the old key and
adds the new key, which may entail removing the object under the old key &
adding the object under the new key.
I do however favor immutable keys as its easier to maintain & program...
Hope this helps
Jay
"dx" <de*********@yahoo.com> wrote in message
news:9i****************@fe05.lga...
Is anyone aware of a way to change the key (string) within a collection .
I have a collection of items, when a 'new' item is added it has a
temporary key which is used until the collection is saved to the database.
I'd like to update the key to reflect the actual Id assigned by the db
once saved.
The key is readonly when i access like this:
Me.Keys.Item(nIdx)
Thanks,
Stan