PDA

View Full Version : Get Parent form name in custom control



Bsbosa.com
07-09-2010, 01:20 PM
Hi Experts,

How to get the parent form name in custom control.
For ex: If the custom control is placed within tab control in mytest form, then my expected result in custom control shall be mytest.

I tried using following options available with custom control
1) this.parent.Findform() : returning null value (this works if the custom control is placed in form directly) fails if the custom control is placed in container i.e in tabcontrol,groupbox etc.
2) this.FindForm() : returning null value
3) this.Parent.Parent: not expected result

Note: In usercontrol there is option available as this.parentform which returns form name. same is not available in custom control

Appreciate to get help in this regard.

Regards
Kartheesh M