okay, so i got lots of buttons on the screen, and i want them all to call the same function when any one of them is clicked... that's easy...
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button2.Click += new System.EventHandler(this.button1_Click);
this.button3.Click += new System.EventHandler(this.button1_Click);
anyhoo, inside of button1_Click() i want to be able to do something to the button that I just clicked... i'm sure this is done with the sender object, but i can't figure it out... this is what I actually have:
Button[,] btnBoard = new Button[3,3];
// ...
for(int x = 0; x < 3; x++)
{
for(int y = 0; y < 3; y++)
{
// ...
// NOTE
this.btnBoard[x,y].Click += new System.EventHandler(this.btnHandler(x, y));
}
}
//...
public void btnHandler(int x, int y)
{
MessageBox.Show("Button[" + x + "," + y + "] has been clicked...");
}
so here's the problem... "NOTE 1" is giving me an error message... it won't let me do that... it'll only let me call a OnClick function from another button... but that way i can't figure out what button is calling the function... HELP!
I can try and be more clear if you're counfused... heh... anyhoo, thanks for your time...
---Current project - Duck Hunt 2: Free at Last!http://www.duckhunt2.cjb.net