Recently, because of work need, regain WinForm.
Using the dev plugin before, rarely using native WinForm, is unfamiliar with the use of many of its controls. So, for the last few days, practice WinForm common controls.
Starting today to see the DataGridView this common control, when you want to implement the data grid when a row is selected, we generally want to get a row of data of the DataRow, because it is convenient to operate. Searched a few pages, and did not find the desired, but also see the individual netizens many years ago, the forum mentioned similar to this problem, but did not find a practical solution in the post. Here, the implementation of their own code to paste out, easy to see.
Just stick to the key code below, and believe it can be understood at a glance.
DataGridViewRow gridrow = datagridview1.selectedrows[0== Row_view. DataView.Table.Clone (); // Cloning a DataTable structure dt. ImportRow (Row_view. ROW); // Copy the target DataRow data into the new DataTable
Gets the selected row on the DataGridView and converts to a DataRow type