Inheritance

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

This is probably an easy question for you experts to
solve: I'm trying to extend the datatable type

Private Class MyDataTable
Inherits DataTable
End Class


Sub Test
Dim mTbl as New MyDataTable
mTbl = GetData
End Sub

This code generates an 'Specified cast is not valid' error
Help me please!
 
Frank said:
This is probably an easy question for you experts to
solve: I'm trying to extend the datatable type

Private Class MyDataTable
Inherits DataTable
End Class


Sub Test
Dim mTbl as New MyDataTable

"New" not required because mTbl will be overwritten anyway in the next line.
mTbl = GetData
End Sub

This code generates an 'Specified cast is not valid' error
Help me please!

The type of GetData is neither MyDataTable nor one of the types derived
from MyDataTable.
 
Thanks for your response!

The type of GetData is DataTable

The next code executes fine:

Sub Test
Dim mTbl as DataTable
mTbl = GetData
End Sub
 
* "Frank said:
This is probably an easy question for you experts to
solve: I'm trying to extend the datatable type

Private Class MyDataTable
Inherits DataTable
End Class


Sub Test
Dim mTbl as New MyDataTable
mTbl = GetData
End Sub

This code generates an 'Specified cast is not valid' error

What's 'GetData'?
 
Thanks for your response

The type of GetData is DataTabl

The next code executes fine

Sub Tes
Dim mTbl as DataTabl
mTbl = GetDat
End Su
 
Thanks for your response!

The type of GetData is indeed DataTable

The next code for example executes fine:

Sub Test
Dim mTbl as DataTable
mTbl = GetData
End Sub
 
Back
Top