I am trying to get the DataGridViewRow with the max record id value. I am able to get the record id itself but I need to find the row itself.
This is my code for getting the max record id and it works fine:
var addedRow =
dataGridView.Rows
.Cast<DataGridViewRow>()
.Where(r => r.Cells[Glossary.RowType].Value.ToString().Equals(Glossary.RowTypeCustom))
.Select(r => Convert.ToInt(r.Cells[Glossary.RecordId].Value))
.Max();
I tried:
.Max(r => r.Cells[Glossary.RecordId].Value);
I am not clear how to the get the row itself so I can give focus to it:
dataGridView.CurrentCell = addedRow;
try using this.
hope it will help.