隐藏具有特定单元格值的行 DataGridView C#

8

我在使用 DataGridView 时遇到了隐藏值为 0 的行的问题。

foreach (DataGridViewRow row in this.taggGrid.Rows)
{
    if (Convert.ToString(row.Cells[4].Value).Equals(0))
    {
        row.Visible = false;
    }
}

我想要隐藏的行仍然显示。

2
请将答案发布为答案,然后接受它 :) 如果您在以后找到解决方案并且不存在答案或没有更好的答案,则回答自己的问题是可以的。 - Mark Schultheiss
1个回答

6

(问题的答案在编辑中由提问者回答。请参见没有答案但在评论或聊天中解决的问题)

提问者写道:

答案:我自己解决了。

foreach (DataGridViewRow dr in taggGrid.Rows)
        {
            if (dr.Cells[4].Value.ToString() == "False")
            {
                dr.Visible = false;
            }
        }

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接