【发布时间】:2016-05-25 05:04:54
【问题描述】:
我正在尝试获取具有最大记录 ID 值的 DataGridViewRow。 我可以自己获取记录 ID,但我需要自己找到行。
这是我获取最大记录 id 的代码,它工作正常:
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();
我试过了:
.Max(r => r.Cells[Glossary.RecordId].Value);
我不清楚如何获取行本身,因此我可以重点关注它:
dataGridView.CurrentCell = addedRow;
【问题讨论】:
标签: c# winforms linq datagridview datagridviewrow