gridView 删除一行后自动定位到指定行

/// <summary>
/// 删除后定位到某一行
/// </summary>
/// <param name="aCode"></param>
/// <returns></returns>
public int LocateRow(string aCode)
{
var list = bindingSource1.DataSource as List<GetNewDateDTO>;
var index = list.IndexOf(list.FirstOrDefault(a => a.Code == aCode));
gridView1.FocusedRowHandle = gridView1.GetRowHandle(index);
gridView1.MakeRowVisible(gridView1.FocusedRowHandle);
return 0;
}

引用该方法即可

上一篇:阿里云centos安装oracle


下一篇:读懂复杂C声明的黄金法则