سؤال

I know to bind datagridview to datatable

                  dgv.DataSource = table2;

But i want to bind in a reverse manner something like this

                  Datatable table2 = dgv.DataSource;

because I am Updating my datagridview for every second and when i close my application I want to store the datagridview in the datatable.I need to do some calculations can any one please help me.Thanks in advance.

هل كانت مفيدة؟

المحلول

Assuming your dgv.DataSource already contains DataTable, you can try to type-cast dgv.DataSource to DataTable :

Datatable table2 = (DataTable)dgv.DataSource;

نصائح أخرى

how to bind datatable to datagridview in c#

Possible duplicate of the above question.

Hope this helps.

Have a nice day! :D

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top