在DataGridViewCheckBoxColumn中更新值发现问题 [英] updating values in DataGridViewCheckBoxColumn is finding problem
问题描述
大家好,
我需要更新datagrid中的复选框值.我可以通过单击datagrid的单元格从事件中执行此操作(即选中或取消选中复选框,它可以正常工作).但是当重新加载窗口时,我通过从以下位置获取值来设置值数据库和更新,如
Hi all,
I need to update check box value in datagrid.I can do this from an event by clicking cells of datagrid(That is checking or unchecking check box it is working fine).But when reload the window I am setting the values by taking values from database and updating like
dataGridView1.Rows[index].Cells["READ"].Value = 1;
其中"READ"是复选框列名.但是它没有显示在窗口中.
请帮帮我.
在此先感谢
where "READ" is the check box column name.But it is not showing in the window.
Please help me.
Thanks in advance
推荐答案
亲爱的朋友,
尝试这样做:-
Dear Friend,
Try to do it like this:-
dataGridView1.Rows[index].Cells.FormattedValue=1;
作为设置时的复选框值,应将其设置为 TRUE 或 False ,但是当您将其设置为1时,它不能映射该值,而是使用FormattedValue,您实际上是将TRUE的值设置为1.
如果可以帮助您,请别忘了将此标记为您的答案.
谢谢
As the checkbox value when set then it should be set TRUE or False but when you are setting it to 1 it is not able to map the value but by using the FormattedValue, you are actually setting the value of TRUE which is 1.
Don''t forget to mark this as your answer if it helps you out.
Thanks
这篇关于在DataGridViewCheckBoxColumn中更新值发现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!