我想显示在datagridview中检查了它的复选框,并隐藏其他行未选中

时间:2015-11-04 00:49:22

标签: c# checkbox datagridview

我有一个datagridview,我有一列复选框,我的代码是

private void button2_Click(object sender, EventArgs e)
{        
    DataGridViewRow row = new DataGridViewRow();
    for (int i = 0; i < dataGridView1.Rows.Count; ++i)
    {
        row = dataGridView1.Rows[i];

        if (Convert.ToBoolean(row.Cells[0].Value) == true)
        {
            this.dataGridView1.DataSource =
        }
    }
}

2 个答案:

答案 0 :(得分:0)

struct tm {
   int tm_sec;         /* seconds,  range 0 to 59          */
   int tm_min;         /* minutes, range 0 to 59           */
   int tm_hour;        /* hours, range 0 to 23             */
   int tm_mday;        /* day of the month, range 1 to 31  */
   int tm_mon;         /* month, range 0 to 11             */
   int tm_year;        /* The number of years since 1900   */
   int tm_wday;        /* day of the week, range 0 to 6    */
   int tm_yday;        /* day in the year, range 0 to 365  */
   int tm_isdst;       /* daylight saving time             */
};

在开始时确保你可以这样做:

row.Visible = false;

答案 1 :(得分:0)

你不需要DataSource来做到这一点。但如果你想再次展示它们,你可能需要它。

Organization