1
I make a class to generate buttons like this:
public Button GerarBotao(string Text, string Name)
{
Button button = new Button();
button.Text = Text;
button.Name = Name;
button.Dock = DockStyle.Top;
button.Size = new System.Drawing.Size(100, 50);
return button;
}
Now in a Form (Windowns Forms) I call the method to create buttons
for (int i = 1; i <= count; i++)
{
string nomeBotão = "vaga" + i;
string texto = "V-" + i + " LIVRE";
p_botoes.Controls.Add(gerarBotoesVagas.GerarBotao(texto, nomeBotão));
}
The count
is the number of buttons it will generate.
Now I’m stuck because I don’t know how to do to generate the click action of the generated buttons. In case the click would lead to another Form, only with the button information it would be the nomeBotao
.
Thank you. It worked perfectly :)
– Luiz Henrique