R – User control added dynamically to a WinForm doesn’t fire its inner controls events

event handlingeventsnetuser-controlswinforms

I have a user control which has several radiobuttons and buttons…
I have code to handle button's click events and radio button's CheckedChange event.

After adding this userControl dynamically to a Form panel, I notice the events of the inner controls are not firing.

I'm doing a "new" of the user control, and adding it to the Controls collection of the Panel.
I'm also calling the "Show" method of the user control.

The LoadEvent of the user control is called… and if I programatically check one of the radio buttons from the OnLoad event handler… the CheckedChange events fires… but if I do it "with the mouse" it doesn't work.

Do you have any idea why the events of the inner controls are not firing?

Thanks in advance!

Best Answer

Problem solved.

In my usercontrol's Constructor I found a DOUBLE call to the InitializeComponent()... It was a copy paste error.

Related Topic