DataGridView 全选,反选
/// <summary> /// 全選 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { dataGridView1.Rows[i].Cells["CODE14"].Value = "1"; } } /// <summary> /// 反選 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button5_Click(object sender, EventArgs e) { for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { dataGridView1.Rows[i].Cells["CODE14"].Value = "0"; } }