I'm trying to get the value of a cell in a DataGridView row using the source query column name. The DataGridView is populated from a BindingSource (as in its DataSource property is set to a BindingSource.)
var obj = dataGridView1.CurrentRow.DataBoundItem;
var item = (DataRow)obj;
On the second line I get an InvalidCastException:
Unable to cast object of type 'System.Data.DataRowView' to type 'System.Data.DataRow'.