How do I get a DataRow from a row in a DataGridView

后端 未结 4 584
长情又很酷
长情又很酷 2020-12-13 09:05

I\'m using a databound Windows Forms DataGridView. how do I go from a user selected row in the DataGridView to the DataRow of the

4条回答
  •  有刺的猬
    2020-12-13 10:00

    DataTable table = grdMyGrid.DataSource as DataTable;
    DataRow row = table.NewRow();
    row = ((DataRowView)grdMyGrid.SelectedRows[0].DataBoundItem).Row;
    

提交回复
热议问题