12
Answers

Convert dataGridView to dataTable

garuka

garuka

15y
88.5k
1
I have a method which returns a dataTable and I use that to populate a dataGridView which works fine.
Then I want to capture the situation where user did modifications to that dataGridView (add new recs, delete, updates).
So what I tried is this
DataTable dt = (DataTable) dataGridView1.DataSource;
but everytime dt returns as null.

Any idea how to fix this?
Answers (12)