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

时间:2013-06-15 14:40:55

标签: datagridview hide rows

我在0隐藏DataGridView值的行时遇到问题。

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

我要隐藏的行仍会显示。

1 个答案:

答案 0 :(得分:2)

(由OP编辑回答。见Question with no answers, but issue solved in the comments (or extended in chat)

OP写道:

  

答案:自己解决了:

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