首页 > Windows开发 > 详细

DataGridView复选框实现单选功能

时间:2016-10-27 13:24:15      阅读:222      评论:0      收藏:0      [点我收藏+]

技术分享

 

 双击DataGridView进入事件

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int count = dataGridView1.Rows.Count;
            for (int i = 0; i < count; i++)
            {
                DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
                Boolean flag = Convert.ToBoolean(checkCell.Value);
                if (flag == true)
                {
                    checkCell.Value = false;
                }
                else
                {
                    continue;
                }
            }

        }

 

DataGridView复选框实现单选功能

原文:http://www.cnblogs.com/Donnnnnn/p/6003483.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!