C# Convert DataGridView to DataTable

I saw some websites which show how to bind dataTable to dataGridView.

But the opposite way was not seen.

I leave as a memorandum how to convert dataGridView to dataTable.

Code to Store DataGridView into DataTable

Here is the code.

※ Not considered when NULL value is in DataGridView.

If necessary, add code to fill in “0” or “” for NULL value.

Unexpectedly, I think that it is convenient because there are times when I want to import to DataTable and update or check data extracted from DB.



メールアドレスが公開されることはありません。 * が付いている欄は必須項目です