比如DataGridView数据比较多,没有分页,需要快速定位某条记录,方法如下:

int index =170 ; //当前需要定位行的索引.
//dataGridView1.Rows[index].Selected = true;//设置为选中.
dataGridView1.FirstDisplayedScrollingRowIndex = index;  //设置第一行显示

It's Ok!!

 

备注:FirstDisplayedScrollingRowIndex
获取或设置某一行的索引,该行是显示在 DataGridView 上的第一行。
设置此属性将引发 Scroll 事件。

相关文章:

  • 2021-07-26
  • 2021-10-30
  • 2021-05-17
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-08
  • 2021-07-09
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案