Does hashtable keep any changes in its values?

mariano_donati

Active member
Joined
Nov 30, 2005
Messages
41
Programming Experience
Beginner
Hi, my question is generic. This is the code:

Dim MyValue As String = "First of all, my value is 6"

Dim SomeKey As Integer = 6

Dim Hashtable As New Hashtable()

Hashtable.Add(SomeKey, MyValue)


Dim ValueLoaded As String = Hashtable(SomeKey)

ValueLoaded = "Now, my value isn't 6, but 9"


Dim NewValueLoaded As String = Hashtable(SomeKey)

MsgBox(NewValueLoaded) 'Returns "First of all, my value is 6"


So, noting that Hashtable doesn't heard of changes I did (it sounds very logical to me), is there a function wich allows me to replace a value passing it the value to replace and the key wich belongs the new value?, something like Hashtable.Replace(Key, NewValue)... or do I have to do it manually like first removing the key and adding the new value then?.
I hope that you understand me.
Thanks in advance.
 
Well, I'm terribly ashamed. I'm so tired that I didn't remember that I have an Item property to stablish the new value of the key. Just I clicked into the Post Quick Reply button, it comes to my mind.
I ask please to the forum moderator to delete this message. May be I post my trouble so quickly and didn't think so much harder, and I want to apologize for that.
Regards.
 
Hi Mariano,
1st off thanks for your kindness. Btw you should be not ashamed about anything here ... it happens all the time to all of us (to miss the obvious) so i would leave this thread if you don't mind (it may be useful for someone - you never know that) ... otherwise, ask ones again and i'll remove it.

Regards ;)
 
Thank YOU very much for your kindness, of course I don't mind if you leave this post, and I really hope that someone can find it useful.
Well, it's time to get some sleep in Argentina (and not to see any computer by other eight hours). So have a good day and again, thank you for treat me like that.
 
Back
Top