'How do I detect and then base an action off of when one of my generated buttons(from a 2D button array) is clicked
So i am generating buttons like this and what i need to do is make those buttons disappear when they are clicked.
{
Button[,] buttonArray = new Button[10, 10];
int xx = 0;
int yy;
for (int x = 50; x <= 430; x+=40)
{
yy = 0;
for (int y = 50; y <= 430; y+=40)
{
buttonArray[xx, yy] = new Button();
buttonArray[xx, yy].Size = new Size(40, 40);
buttonArray[xx, yy].Location = new Point(x, y);
this.Controls.Add(buttonArray[xx, yy]);
yy++;
}
xx++;
}
}```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|