Q
Q
Hi,
I'm using a hashtable to store away a bunch of numbers from my array:
The Hashtable should look like:
Key Value
1 01234
2 01235
3 01245
....
10 23456
I use a module to keep my Hashtable "alive" all times/during the whole
runtime:
Module ModGlobVariablen
Public lfdNrHash As Integer = 1
Public myHashTable As New Hashtable
End Module
I do have a subroutine (very simple)that I call each time a value in my
array has changed:
Private Sub FillHashTable(ByVal Wert)
myHashTable.Add(lfdNrHash, Wert)
lfdNrHash = lfdNrHash + 1
End Sub
Everything works fine, no error is raised, but if I debug step-by.step I
see the following result:
Key Value
1 23456
2 23456
3 23456
...
10 23456
Befor there was correct data in each HashTable Key, but in the end all
data is overwritten with the last value of my array !
Meaning each "myHashTable.Add(lfdNrHash, Wert)" deletes all old
hashtable values (not the keys) and replaces them with the new array
value!
Why does "myHashTable.add" do that?
Each time a new value with a new key is written, the old precursor value
is overwritten.....
Pls help.
I'm using a hashtable to store away a bunch of numbers from my array:
The Hashtable should look like:
Key Value
1 01234
2 01235
3 01245
....
10 23456
I use a module to keep my Hashtable "alive" all times/during the whole
runtime:
Module ModGlobVariablen
Public lfdNrHash As Integer = 1
Public myHashTable As New Hashtable
End Module
I do have a subroutine (very simple)that I call each time a value in my
array has changed:
Private Sub FillHashTable(ByVal Wert)
myHashTable.Add(lfdNrHash, Wert)
lfdNrHash = lfdNrHash + 1
End Sub
Everything works fine, no error is raised, but if I debug step-by.step I
see the following result:
Key Value
1 23456
2 23456
3 23456
...
10 23456
Befor there was correct data in each HashTable Key, but in the end all
data is overwritten with the last value of my array !
Meaning each "myHashTable.Add(lfdNrHash, Wert)" deletes all old
hashtable values (not the keys) and replaces them with the new array
value!
Why does "myHashTable.add" do that?
Each time a new value with a new key is written, the old precursor value
is overwritten.....
Pls help.