【问题标题】:A databound datagridview on update doesn't display the top rows更新时的数据绑定数据网格视图不显示顶行
【发布时间】:2012-10-24 15:01:35
【问题描述】:

当新行添加到datasource 时,datagridview 会更新,但自动显示在视图中的行,即不需要滚动到“旧”行。先前选择的行位于可查看行的底部。我希望显示最新的行,即滚动条始终位于顶部。

我尝试取消选择datagridview 中的所有行:

dataGridView1.ClearSelection();
dataGridView1.CurrentCell = null; 

虽然没有选择行,但datagridview 顶部的行不会自动显示。 datagridview 仍会跳转以显示先前选择的行。

【问题讨论】:

    标签: c# .net visual-studio-2010 data-binding datagridview


    【解决方案1】:
    dataGridView1.ClearSelection();
    dataGridView1.CurrentCell = null;
    dataGridView1.FirstDisplayedScrollingRowIndex = 0;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 2019-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多