问题描述
您好,c#专家,
我有一个数据网格视图,其中有三列.
第三列是复选框列
我的要求是,如果第1列的值为null,则应取消选中并禁用同一行中的复选框(用户应无法对其进行检查)
如果第一列中有一些文本或值,则应启用该复选框,并应允许用户选中或取消选中该复选框.
我是C#的新手,不确定如何实现此目标.感谢您的所有帮助.提前谢谢.
datagridview名称:GridASourceQueue
列
1-ALQAQ
2-MAXMSGL
3-ALBOQ
问候,
Vinay
Hi c# gurus,
I''ve a data grid view with three columns in it.
the third column is a checkbox column
my requirement is, if the column 1 value is null, then the check box in the same row should be unchecked and disabled (the user should not be able to check it)
if there is some text or value in column one, then the check box should be enabled and should allow the user to check or uncheck.
I am new to c# and not sure how to achieve this. appreciate all your help. Thanks in advance.
datagridview name : GridASourceQueue
columns
1 - ALQAQ
2 - MAXMSGL
3 - ALBOQ
Regards,
Vinay
推荐答案
if (GridASourceQueue[1, 0].Value == null)
{
GridASourceQueue.Rows[0].Cells[2].Value = 0;
GridASourceQueue.Rows[0].Cells[2].ReadOnly = true;
}
else
{
GridASourceQueue.Rows[0].Cells[2].Value = 0;
GridASourceQueue.Rows[0].Cells[2].ReadOnly = false;
}
谢谢.
Thanks.
这篇关于禁用datagridview中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!