Hello community members!! I have the following question:
Is it possible to go through all the buttons in a form using any kind of iteration?
I found that i can use this:
int x = 0;
foreach (Control control in this.Controls)
{
if (control is Button)
{
if (control.Text == "0")
{
x += 1;
}
}
}
label1.Text = Convert.ToString(x);
Example of application
But it's not exactly what i'm looking for. Basically i want for each label to show how many values of 0 i have in that row/column.
Example: label6 will show 0
label 7 will show 2
label 8->2
label 9->3
label 2->2
label 3->1
etc.
How can i do that?
Label 1's text is 0 because i tried to do something but it didn't work, ignore it.
Thanks for the help again :D