Window c# Desktop Application
I want to initialize a DataRow object
with the selected row of DataGrdView
.
Is it possible if yes then how?
I am writting the followind code and it is giving compilation error.
DataRow dr = (DataRow)DataGridView1.SelectedRows[0];
Thanks
Try this:
DataRow dr = (DataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row;
try this
DataRow dr = (dataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row;