J
John Dann
I want to save the value of an enum variable in a hashtable but a
little confused as to what I can and can't do. I sort of imagined that
I could do eg:
Dim MyEnumVar as MyEnum = MyEnum.whatever
MyHashtable.Add(MyKey, MyEnumVar)
and then retrieve the value using:
MyEnumVar2 = MyHashTable(MyKey)
But this is giving me an invalid cast error (String to Integer). And:
MyEnumVar2 = CType(MyHashTable(MyKey), MyEnum)
doesn't help. I guess I could parse the hashtable value back to the
enum, but I'm a bit puzzled as to why I can't retrieve the enum value
directly. Anyone care to comment please?
Thanks
JGD
little confused as to what I can and can't do. I sort of imagined that
I could do eg:
Dim MyEnumVar as MyEnum = MyEnum.whatever
MyHashtable.Add(MyKey, MyEnumVar)
and then retrieve the value using:
MyEnumVar2 = MyHashTable(MyKey)
But this is giving me an invalid cast error (String to Integer). And:
MyEnumVar2 = CType(MyHashTable(MyKey), MyEnum)
doesn't help. I guess I could parse the hashtable value back to the
enum, but I'm a bit puzzled as to why I can't retrieve the enum value
directly. Anyone care to comment please?
Thanks
JGD