Hide row with specific cell value DataGridView C#

user2488982 picture user2488982 · Jun 15, 2013 · Viewed 11.6k times · Source

I'm having trouble hiding rows with 0 value in DataGridView.

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

The row I want to hide still shows.

Answer

Brian Tompsett - 汤莱恩 picture Brian Tompsett - 汤莱恩 · Jan 26, 2015

(Answered by the OP in edits. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

ANSWER: Solved it myself:

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