Click to See Complete Forum and Search --> : Array cast error


zombie_man23
September 16th, 2005, 11:44 AM
I want to put a dataset record into an array. I get a "Specified cast is not valid." error when I try to set the value to the array. Any ideas on what I need to do? Thanks in advance!

arrStudent(1, 0) = Type(dsStudent.Tables("tmpAttend").Rows(0)("StudentID"), ArrayList)

hspc
September 17th, 2005, 10:45 AM
You should cast it to the same type you used for array declaration
for example : if you declared arrStudent like this :
Dim arrStudent(10,1) as Integer
you shuld cast the value to Integer:
arrStudent(1, 0) = Type(dsStudent.Tables("tmpAttend").Rows(0)("StudentID"), Integer)

zombie_man23
September 19th, 2005, 09:04 AM
Thanks for the help!!
I see my problem now.