I am a brand spanking a new one for LINQ and am trying to use it in my current hobby project. I have datagridviewwhere the first cell of each row is datagridviewcheckboxand the fourth cell is a row.
If checked, I need to add the 4th cell value to the list.
At first I tried:
var selectedID = from c in multiContactLookup.SelectedCells.Cast<DataGridViewCell>()
select multiContactLookup.Rows[c.RowIndex].Cells[4].Value;
This did not work because the checked cells were not programmatically selected, therefore it is cnever a value.
Then I tried:
var sel2 = from r in multiContactLookup.Rows.Cast<DataGridViewRow>()
where r.Cells[0].Value is true select r.Cells[4].Value;
but for some reason my syntax is incorrect.
Using LINQ, how can I select the rows in which the first cell is checked, and then select the value of the first cell? Should I split it into two collections?
Thank!