Hide row with specific cell value DataGridView C#
Asked Answered
T

1

8

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.

Typical answered 15/6, 2013 at 14:40 Comment(1)
Please post answer as answer and then accept it :) It is OK to answer your own question if you find the solution later and no answers exist or none better exist.Bigamy
C
6

(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;
            }
        }
Churchill answered 15/6, 2013 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.