Q:

how to get click button event of dynamically created button C# winforms

I have code which generates buttons dynamically
Button txt = new Button();
this.Controls.Add(txt);
txt.Top = cleft * 40;
txt.Name = "txt_" + cb;
txt.Size = new Size(200, 16);
txt.Left = 150;

But I cannot think how to generate its click event.

A:

I assume you don't mean "how to generate", but rather how to handle. Since you have a reference to your dynamic button, just add an event handler:
txt.Click += new EventHandler(eventHandlerFunction);

Or use a lambda:
txt.Click += (object sender, EventArgs e) => ...;

