Reputation: 3
private void gunaButton1_Click(object sender, EventArgs e) { for (int i = 0; i < 1; i++) { GunaButton btn = new GunaButton();
//add btn to flowlayoutpanel to arrange buttons flowLayoutPanel1.Controls.Add(btn); Form2 f = new Form2(); //how can i make object of button show new object of form2 btn.Click +=new System.EventHandler(f.ShowDialog()); } }
Upvotes: 0
Views: 51
Reputation: 94
Try:
btn.Click += new System.EventHandler(this.btn_Click);
private void btn_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog();
}
Upvotes: 0