I need some help on how can i put some Event handler on my Button mybtn using code.

 private void button1_Click(object sender, EventArgs e)
 {
      Button mybtn = new Button();  
      mybtn.Text = "First"; 

        FlowLayoutPanel flowlayoutpl = new FlowLayoutPanel();
        flp.Controls.Add(mybtn);
        panel.Controls.Add(flowlayoutpl);
 }

You would add something like either of the following statements:

mybtn.Click += new EventHandler(mybtn_Click);
//--or--
mybtn.Click += mybtn_Click;

wow thanks,it's working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.