Link to home
Start Free TrialLog in
Avatar of timmyzx7r
timmyzx7r

asked on

Casting type of enumerators

Hello experts,

An easy question I should know.  What or how does this need to be casted with Option Strict on?

Console.WriteLine(myEnum.Current.Row.Item("BasicInfoID"))

I thought Enums where int16 varible types but I am having a hard time casting it.

Thanks,
-Tim

The commented lines ('***) are the solution I had to use because I can not cast.

Dim myEnum As IEnumerator = ds.Tables("utblBasicInfo").DefaultView.GetEnumerator()
'***Dim dv As DataRowView
'***Dim dr As DataRow
While myEnum.MoveNext
     Console.WriteLine(myEnum.Current.Row.Item("BasicInfoID"))
     'Console.WriteLine(CType(myEnum.Current.Row.item("BasicInfoID"), Int16))
     '***dr = CType(myEnum.Current, DataRowView).Row
     '***dr.Item("Status") = "Expired"
     '***Console.WriteLine(dr.Item("BasicInfoID"))
     '***Console.WriteLine(dr.Item("Status"))
End While
ASKER CERTIFIED SOLUTION
Avatar of RonaldBiemans
RonaldBiemans

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RonaldBiemans
RonaldBiemans

And remember

Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection