Ctype Datasource to DataTable .. always empty?

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?
 
G

geno1

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top