在对DataGridView编程的时候,需要隐藏其中的某些行。采用:
this.dataGridView1.Rows[i].Visible = false;
就可以达到隐藏数据行的目的。但有时候会报以下的错误:
Row associated with the currency manager's position cannot be made invisible.
其原因是,dataGridView1的CurrentCell所在的行是不能删除的。因此,在隐藏列之前只需要将CurrentCell指向其他行的Cell就可以了。示例代码:
dataGridView1.CurrentCell = dataGridView1.Rows[1].Cells[0];
this.dataGridView1.Rows[0].Visible = false;
 
                    
                     
                    
                 
                    
                 

 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号