现在想要的功能是:
datagridview里的内容每5秒刷新一次,然后用户可以选中其中某一行,做一些操作遇到的问题是,
现在是每5秒刷新,用户可能选中一行后,还没来的及去做操作,datagridview就刷新了,这时用户对某行的选中状态也没有了。请问如何解决这个问题呢?

解决方案 »

  1.   


            private int _RowIndex = 0;
            private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) //在dataGridView的CellClick()事件中,记录下当前所选取中的行号        {
                _RowIndex = e.RowIndex;
            }            dataGridView1.Rows[_RowIndex].Selected = true;  //设置历史选中行的选中状态为true