My datagrid datasource is an array of objects of data container class.
Me.dGridComments.DataSource = CommentsData.CommentsArray
CommentsData = Object of my worker class
CommentsArray = Array of Objects of my Data Container class.
I want to build a table structure on my datagrid.
Dim dt As DataTable
dt = CType(grid.DataSource, DataTable)
When I run above code, i get this error:
"
An unhandled exception of type 'System.InvalidCastException' occurred in ProjectComments.exe
Additional information: Specified cast is not valid.
"
Any suggestion will be appreciated.
Thanks
NOTE: I cannot change my datasource.