sarfraz
April 23rd, 2002, 07:05 AM
I have written a function that returns an array of Structure UnitClass,but It returns it as System.Array.Now when i try to typecast it back into the UnitClass array in the calling procedure,a runtime error occurs saying.
Specfic cast is not allowed.
Can anybody explain this behavior.
Structure UnitClass
Dim name as String
Dim factor as double
End Structure
Dim Uclass() as UnitClass
Dim temp as object
temp = Uclass
'//Temp is passed byref in the function
SampleFunction(2,temp)
'//Now i want to get the values back into Uclass
Uclass = temp '//does not work
Uclass =CType(temp,System.Array)'//does not work
Uclass =CType(temp,UnitClass)'//does not work
Any help from anyone would be appricieated.
Specfic cast is not allowed.
Can anybody explain this behavior.
Structure UnitClass
Dim name as String
Dim factor as double
End Structure
Dim Uclass() as UnitClass
Dim temp as object
temp = Uclass
'//Temp is passed byref in the function
SampleFunction(2,temp)
'//Now i want to get the values back into Uclass
Uclass = temp '//does not work
Uclass =CType(temp,System.Array)'//does not work
Uclass =CType(temp,UnitClass)'//does not work
Any help from anyone would be appricieated.