int locy = 41; for (int i = 0; i < hdcount; i++) { RadioButton rdbtn = new RadioButton(); rdbtn.Name = "rdbtn" + i.ToString(); rdbtn.Location = new System.Drawing.Point(12, locy); rdbtn.Enabled = false; this.Controls.Add(rdbtn); locy += 23; rdbtn.CheckedChanged += new EventHandler(rdbtn_CheckedChanged); }
The last line of code. it makes a new event handler for radio button checked changed event.
And I want to know how can I make this program add some code inside the programmatically generated eventhandlers programmatically ?
I need to add "button3.Enabled = true;" code in all the radiobutton CheckedChanged events programatically.
How can I do this ?