tags:

views:

96

answers:

1

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)

+2  A: 

This seems very similar to this SO Question (http://stackoverflow.com/questions/371464/get-components-parent-form)

Is this what you are trying to do?

Joseph
The answer i selected in the question linked does exactly what you are after from the looks of your question.
Pondidum
I thought the same thing.
Joseph
Thanks - I guess I relied to much on the "suggested links" list.
peterchen