首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c/s里的datagridview有关问题

2012-03-28 
c/s里的datagridview问题?我想把datagridview里的某一行的某一单元格的值不显示出来,应该怎么做呢?[解决办

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 = "";

热点排行