Ctype Datasource to DataTable .. always empty?

  • Thread starter Thread starter jobs
  • Start date Start date
J

jobs

The below always results in an empty table, when I know the Gridview
has rows.

Dim dataTable As DataTable = CType(ChargeGridView.DataSource,
DataTable)
If Not (dataTable Is Nothing) Then '****** (THIS IS ALWAYS
FALSE) ****

Is there a correct way to do this?
 
I think you should try to display the dataTable of the dataSet that you
originally set the ChargeGridView.DataSource to

say

Dim ds as DataSet
'Fill ds with data
ChargeGridView.DataSource = ds

'now you can access the data in the ds
Dim dataTable As DataTable = ds.tables(0)
 
Back
Top