1
我有一个数据绑定DataGridView的窗体。 我使用IDataError接口来处理错误,它工作完美,显示行标题中有红色标记的错误。Databound DataGridView - IDataError
但是,如何让光标跳到错误的第一行。
在此先感谢..
我有一个数据绑定DataGridView的窗体。 我使用IDataError接口来处理错误,它工作完美,显示行标题中有红色标记的错误。Databound DataGridView - IDataError
但是,如何让光标跳到错误的第一行。
在此先感谢..
推测,通过迭代它们?
foreach(DataGridViewRow row in view.Rows)
{
IDataErrorInfo dei = row.DataBoundItem as IDataErrorInfo;
if (dei != null && !string.IsNullOrEmpty(dei.Error))
{
if(row.Cells.Count > 0) view.CurrentCell = row.Cells[0];
view.FirstDisplayedScrollingRowIndex = row.Index;
break;
}
}