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.
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.