Hi
I have below code :
foreach (Control c in frmM.tableLayoutPanel1.Controls ) { foreach (DataRow row in table.Rows) { foreach (var item in row.ItemArray) { var button = c as Button; if ((button.Name.ToString() == item.ToString())) { button.Enabled = false; } } } }
the condiyion of IF work but unfortunately the below line don't work:
button.Enabled = false;
and also I want use
foreach (Control c in frmM.Controls )
but because my form don't have button directely so this code isn't useful for me.
Is there any better code that I could use?