winform中DataGridView使用DataGridViewCheckBoxColumn实现RadioBox单选功能

时间:2017-08-29 18:26:33   收藏:0   阅读:441
private void dgvMaterial_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            for (int i = 0; i < dgvMaterial.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell ck = dgvMaterial.Rows[i].Cells[0] as DataGridViewCheckBoxCell;
                if (i != e.RowIndex)
                {
                    ck.Value = false;
                }
                else
                {
                    ck.Value = true;
                }
            }
        }

 

原文:http://www.cnblogs.com/jiangshuai52511/p/7449695.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!