·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP网站建设 >> datagridview checkbox控件

datagridview checkbox控件

作者:佚名      ASP网站建设编辑:admin      更新时间:2022-07-23
在Winform中,DataGridView中使用Checkbox控件时

//单击单元格事件


PRivate void dgvTables_CellClick(object sender, DataGridViewCellEventArgs e)

        {

            if (e.ColumnIndex == 0)

            {

                DataGridViewCheckBoxCell dgvCheck = (DataGridViewCheckBoxCell)dgvTables.Rows[e.RowIndex].Cells[0];

                if (dgvCheck.Selected)

                {

                    dgvCheck.Value = !((bool)dgvCheck.FormattedValue);                    

                }

            }

        }



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/netgyc/archive/2009/12/28/5089318.aspx