在对DataGridView编程的时候,需要隐藏其中的某些行。采用:

this.dataGridView1.Rows[i].Visible = false;

就可以达到隐藏数据行的目的。但有时候会报以下的错误:

Row associated with the currency manager's position cannot be made invisible.

其原因是,dataGridView1CurrentCell所在的行是不能删除的。因此,在隐藏列之前只需要将CurrentCell指向其他行的Cell就可以了。示例代码:

dataGridView1.CurrentCell = dataGridView1.Rows[1].Cells[0];

this.dataGridView1.Rows[0].Visible = false;

相关文章:

  • 2022-01-05
  • 2022-02-10
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2021-06-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案