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";
            }   
        }

  

posted @ 2022-01-19 08:24  zq爱生活爱代码  阅读(66)  评论(0编辑  收藏  举报