更新时间:2022-10-29 19:50:08
null
这里不是一个好的测试 - 如果单元格值是 null
它不是一个按钮!
但即便如此,也没有内置的方法来禁用它: https://msdn.microsoft.com/en-us/library/ms171619(v = vs.110).aspx [ ^ ]解释,并说明如何操作。
请参考如何:在Windows窗体中禁用按钮列中的按钮DataGridView控件
[ ^ ]
这里是this .button1.disable;
I Have A D.G.V And All Of My Column's Type Is DataGridViewButtonColumn , I Want To Disable Some Of That Button's
Like
row[1].cell[1] or somthing else
What I have tried:
if (dataGridView1.Rows[0].Cells[0].Value == null)
{
/// disable that button
}
null
is not a good test here - if the cell value isnull
it's not a button!
But even then there is no built in way to disable it: https://msdn.microsoft.com/en-us/library/ms171619(v=vs.110).aspx[^] explains, and shows how to do it.
Please refer How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control
[^]
here is itthis.button1.disable;