It turns out that I'm starting to program in C #, well, my problem is that I have a Button matrix and when I initialize the buttons I add a method in the Click event, I would like to know if parameters can be passed to the method of the event.
I have the initialization of my matrix like this:
for(int x = 0; x < celdas.GetLength(0); x++)
{
for (int i = 0; i < celdas.GetLength(1); i++)
{
celdas[x, i] = new Celda();
celdas[x, i].SetBounds(i * anchoCelda, x * altoCelda, anchoCelda, altoCelda);
celdas[x, i].UseVisualStyleBackColor = true;
celdas[x, i].Click += evento;
this.panelMatriz.Controls.Add(celdas[x, i]);
}
}
In the 'Event' method I want to use the row and column of the button. but I see the way to send them to the method.
public void evento(object sender, EventArgs e)
{
Celda celda = ((Celda)sender);
MessageBox.Show(celda.Destapada+"");
}
an example, that by pressing the button that shows me the row and the column where it is.