I'm trying to develop Keno Game in C#, so I have 80 buttons where each of them has the numbers from 1-80 like this:
So what I want to do is that each user should choose 10 numbers (not less, not more) and when a button is being clicked the background color of the button turns green, but I want to know how can that be done without calling the event on each button. These numbers should be saved on the database.
I have tried adding the buttons on a array and looping through the array like this:
var buttons = new[] { button1, button2, button3, button4, button5, ..... };
foreach (var button in buttons)
{
if (button.Focused)
{
button.BackColor = Color.Green;
}
}
