Ok, I have always been able to iterate though a hashtable with the "Option Strict turned Off" but after someone suggesting I should code with it ON for good practice reasons, Now I'm running into problems Iterating though a Hashtable that I store a Class object in..
The old way worked fine..
Code:Dim en As IDictionaryEnumerator = HashTest.GetEnumerator With lstID .BeginUpdate() .Items.Clear() While en.MoveNext Dim R As clsTest = en.Value .Items.Add(R.MyID) End While .EndUpdate() End With
Now that I have turned Option Strict on, it bugs out, I get an error that says..
Option Strict On disallows implicit conversions from 'System.Object' to 'Hashing.clsTest'.
which applies to this:
I have tried to cast it by doingCode:Dim R As clsTest = en.Value
But it won't let me cast it to that class type..Code:Dim R As clsTest = CType(en.Value, clsTest)
Does anyone know what I need to do in order to do this?




Reply With Quote