This is my first post and i am new to c#. I have a bindinglist
How can i fetch the selected rows in the datagridview directly as (customObject) or list of them. I am getting a DataGridViewSelectedRowCollect
Thanks
regards,
Dewang
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bryian TanPosted Aug 31, 2010, 9:27 PM
You can use the DataGridViewRow.DataBoundItem Property. Try this way
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow theRow = dataGridView1.SelectedRows[0];
YourCustomObject yourCustomObject = theRow.DataBoundItem as YourCustomObject;
}
Thanks,
Bryian Tan