DataGridViewCheckBoxCell是没有得到确认 [英] DataGridViewCheckBoxCell is not getting checked

查看:134
本文介绍了DataGridViewCheckBoxCell是没有得到确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DataGridViewCheckBoxCell是没有得到检查。我已经插入这样

  DataGridView1.Columns.Insert(0,新DataGridViewCheckBoxColumn {名称=打印})第一列; 

这是行不通的。



  DataGridView1.Rows [0] .Cells [0] .value的= TRUE; 



无论这是工作。



  DataGridView1.Rows [0] .Cells [0] .value的= cell.TrueValue; 



可能是什么这是没有得到确认?


解决方案

我不知道为什么它不为你工作,但你可以试试下面的方法来代替。

  dataGridView1.Rows [0] .SetValues(真); 

这将只检查的第一个项目。当你想为多个单元格的值,只需使用更多的参数。

  VAR值=新布尔[] {真,假,真实}; 
dataGridView1.Rows [0] .SetValues(值);

这将检查第一和第三小区,但第二小区将保持未选中。

DataGridViewCheckBoxCell is not getting checked. I have inserted the first column like this

DataGridView1.Columns.Insert(0, new DataGridViewCheckBoxColumn { Name = "Print" });

This is not working

DataGridView1.Rows[0].Cells[0].Value = true;

Neither this is working

DataGridView1.Rows[0].Cells[0].Value = cell.TrueValue;

What could be the reason it is not getting checked?

解决方案

I don't know why it is not working for you, but you can try following method instead.

dataGridView1.Rows[0].SetValues(true);

This will only check the first item. When you want to set values for more cells, just use more parameters.

var values = new bool[] { true, false, true };
dataGridView1.Rows[0].SetValues(values);

This will check the first and the third cell, but the second cell will remain unchecked.

这篇关于DataGridViewCheckBoxCell是没有得到确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆