日期:2014-05-18  浏览次数:20781 次

c/s里的datagridview问题?
我想把datagridview里的某一行的某一单元格的值不显示出来,应该怎么做呢?




------解决方案--------------------
dataGridView.Rows[i].Cells[j].Value = null;
这样就是把这一单元格里的值给清空,好像不是你要的,

楼上的一定是错误的,因为dataGridView.Rows[].Cells[].Visible属性是只读的
------解决方案--------------------
dataGridView.Rows[i].Cells[j].Value=null;
------解决方案--------------------
如果是 绑定的是不行的,
如果是自己填充的数据
dataGridView.Rows[i].Cells[j].Value=null;是可以的
------解决方案--------------------
我的是綁定的,下面兩種方法都可以呀

//int count = this.dataGridView1.Rows.Count-1;
// for (int i = 0; i <= count; i++)
// {
// this.dataGridView1.Rows[i ].Cells[1].Value = "";
// this.dataGridView1.Rows[i ].Cells[2].Value = "";
// this.dataGridView1.Rows[i ].Cells[3].Value = "";
// }


int count = this.dataGridView1.Rows.Count - 1;
for (int i = 0; i <= count; i++)
{
this.dataGridView1.Rows[i].Cells[1].Value = null ;
this.dataGridView1.Rows[i].Cells[2].Value = null;
this.dataGridView1.Rows[i].Cells[3].Value = null;
}

------解决方案--------------------
dataGridView.Rows[].Cells[].Text = "";