我在使用 DataGridView
时遇到了隐藏值为 0
的行的问题。
foreach (DataGridViewRow row in this.taggGrid.Rows)
{
if (Convert.ToString(row.Cells[4].Value).Equals(0))
{
row.Visible = false;
}
}
我想要隐藏的行仍然显示。
我在使用 DataGridView
时遇到了隐藏值为 0
的行的问题。
foreach (DataGridViewRow row in this.taggGrid.Rows)
{
if (Convert.ToString(row.Cells[4].Value).Equals(0))
{
row.Visible = false;
}
}
(问题的答案在编辑中由提问者回答。请参见没有答案但在评论或聊天中解决的问题)
提问者写道:
答案:我自己解决了。
foreach (DataGridViewRow dr in taggGrid.Rows)
{
if (dr.Cells[4].Value.ToString() == "False")
{
dr.Visible = false;
}
}