110,536
社区成员
发帖
与我相关
我的任务
分享
//全选
private void btnAllchoose_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
dataGridView1.Rows[i].Cells[0].Value = true;
}
}
//反选
private void btnRchose_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
if ((Boolean)chk.EditedFormattedValue == true)
{
dataGridView1.Rows[i].Cells[0].Value = false;
}
else
dataGridView1.Rows[i].Cells[0].Value = true;
}
}