Can someone explain this new-to-visualbasic programmer why my statement
throws an exception?
I have defined a class:
Class myDataSet
Inherits System.Data.DataSet
Public Sub fun(ByVal someparm As String)
dosomething()
End Sub
End Class
And I created a webservice function that returns a System.Data.DataSet
I try to stuff this dataset into my own dataset-type
dim myDataSet mds as myDataSet = new myDataSet
'mds = dswebsvc(arg) ' vbcompiler does not allow this but rather:
mds = CType( dswebsvc(arg), myDataSet) ' compiler allows this
But at runtime, this statement throws an exception with the message:
Unable to cast object of type 'System.Data.DataSet' to type 'myDataSet'
To overcome this problem I tried to overload the CType() function in the
myDataSet class but that is not allowed since apparently the compiler
automatically generates this overload!
What can I do to get rid of this nasty exception?
Bert