Hi all!
As you probably have guessed, I have a problem. And as such I would like to use your collective knowledge so I can continue.
I have a form that has a crapload of buttons on it. so, because I was being lazy, I created myself a ButtonGenerator. Here is the code for that:
public void ButtonGenerator(string ButtonName, string ButtonText, int ButtonHeight, int ButtonWidth, int ButtonTop, int ButtonLeft)
{
Button NewButton = new Button();
NewButton.Name = ButtonName;
NewButton.Text = ButtonText;
NewButton.Height = ButtonHeight;
NewButton.Width = ButtonWidth;
NewButton.Top = ButtonTop;
NewButton.Left = ButtonLeft;
this.Controls.Add(NewButton);
}
so I can use something like this:
ButtonGenerator("ButtonQ", "Q", 20, 20, 60, 20);
However...
Now I require my program to sort of highlight a button. This can be done by changing the backgroundcolor of it, or setting the Selected property to true, or whatever way, I don't really care as long as it is clear which button is about to do it's thing.
But how do I access the buttons? I hoped that by adding a Name property I would be able to acces it somehow. I either I can't figure out how, or that is not how it works.
So... How does it work?
Thanks in advance for any answers provided!