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"; } }
标签:Count,Rows,sender,int,Cells,反选,DataGridView,全选,dataGridView1 来源: https://www.cnblogs.com/JerryZhang320/p/15820816.html