> Hello,
>
[quoted text clipped - 18 lines]
> convert them, or not, to numbers) for my hashtable. Is this the most
> sensible solution?
I would probably code a couple of static arrays and add them to a hashtable
at load time.
something like this
int[] keys = {2,4,6,8,10};
string[] values = { "a", "b", "c", "d" ,"e"};
Hashtable t = new Hashtable();
for (int i=0;i<keys.Length;i++)
{
t.Add(keys[i],values[i]);
}
David
mark4asp - 28 Sep 2004 18:23 GMT
>> Hello,
>>
[quoted text clipped - 33 lines]
>
>David
I needed to use a SortedList not a HashTable. eg.
Dim AconsFin(,) As String =
{{"2","m"},{"4","n"},{"6","ng"},{"8","r"},{"10","l"},{"12","kh"},{"14","k"},{"16","s"},{"18","hl"},{"19","tl"},{"20","sh"}}
Dim consFin As New SortedList()
Load_SortedList(AconsFin, consFin)
Show_SortedList(consFin)
Sub Load_SortedList(ary, ht)
For i As Integer = 0 To UBound(ary, 1)
ht.Add(CInt(ary(i , 0)), ary(i , 1))
Next
End Sub
Sub Show_SortedList(ht As SortedList)
Dim hEnum As IDictionaryEnumerator = ht.GetEnumerator()
Dim str As String
While hEnum.MoveNext()
str += hEnum.Key.toString() & " : " &
hEnum.Value.toString() & vbCrLf
End While
txtEncounter.text = str
End Sub