How to make a DataTable from DataGridView without any Datasource?

前端 未结 3 831
野性不改
野性不改 2020-12-03 14:57

I want to get a DataTable from DataGridView of the Grid values.

In other words DataTable same as DataGridView Values

3条回答
  •  执笔经年
    2020-12-03 15:14

    you can use the following code also, this code fill not effect on your DataGridView when you do some add or delete rows in the datatable

    DataTable dt = new DataTable();
    dt = Ctype(dataGridView1.DataSource,DataTable).copy();
    

提交回复
热议问题