I'm making a windows forms application using C#. I add buttons and other controls programmatically at run time. I'd like to know how to handle those buttons' click events?
Try the following
Button b1 = CreateMyButton(); b1.Click += new EventHandler(this.MyButtonHandler); ... void MyButtonHandler(object sender, EventArgs e) { ... }
2.1m questions
2.1m answers
60 comments
57.0k users