[英]How to get the rows in a Datagrid that are customized in c#?
I have a Datagrid with n rows. 我有n行的Datagrid。 And some of the rows of the datagrid have the backcolor as green.
并且数据网格的某些行的底色为绿色。 I also have a button.
我也有一个按钮。 How can I disable the button when no rows of my Datgrid are in green.
当我的Datgrid的行没有绿色时,如何禁用该按钮。
Get the count of green colored cells 获取绿色细胞的数量
int greenColuredCells = (dgv.Rows.Cast<DataGridViewRow>()
.Where(r => r.Cells[0].Style.BackColor == Color.Green)
.Count();
and use this to hide show butten 并使用它来隐藏显示
btn.enable = greenColuredCells>0;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.