111,125
社区成员
发帖
与我相关
我的任务
分享
代码
foreach( DataGridViewRow rows in dataGridView.Rows )//如果DataGridView中有空的数据,则提示数据输入不完整并退出添加,这里的rows包括标题行
{
foreach( object cell in rows.Cells )
{
DataGridViewCell d= (DataGridViewCell) cell;
if( d.Value==你要屏蔽的数据 )
{
单元格的visible=false ;
return;
}
}
}
不包括标题行
代码
for( int i=0 ; i<dataGridView.Rows.Count-1 ; i++ )//如果DataGridView中有空的数据,则提示数据输入不完整并退出添加,不包括标题行
{
foreach( object cell in dataGridView专家模式.Rows[i].Cells )
{
DataGridViewCell d= (DataGridViewCell) cell;
if( d.Value==null )
{
单元格的visible=false ;
return;
}
}
}