3

From a custom Winforms component that is embedded in a form, how to I get the parent/owner control?

I have an IContainer and the Site property is not null, but I have no idea how to get to the "real" parent.

(this is a followup to this question, atm I am trying to add a handler to the parents VisibleChanged, but that's not the first time I face this question)

Community
  • 1
  • 1
peterchen
  • 40,917
  • 20
  • 104
  • 186

1 Answers1

0

Not Ideal, but try this...

Change the usercontrol to Component class (In the code editor), build the solution and remove all the code with errors (Related to usercontrols but not available in components so the debugger complains about it)

Change the usercontrol back to usercontrol class...

Now it recognises the name and parent property but shows the component as non-visual as it is no longer designable.

Tery Aldon
  • 11
  • 1