L
Levis
Hi,
I inherited Button and I created my component (MyButton)
In this button onclick event I want show this objects parent form. When my
form is not MDIChild this codes run correct. But when my form is MDIChild
this codes show MDIParents name.
How can I show parent form name (not MDIParent)
public class MyButton: System.Windows.Forms.Button{
{
....
protected override void OnClick(EventArgs e)
{
if (this.TopLevelControl is Form)
{
Form Form_ = (Form)this.TopLevelControl;
MessageBox.Show(Form_.Name);
}
base.OnClcik(e
}
....
}
I inherited Button and I created my component (MyButton)
In this button onclick event I want show this objects parent form. When my
form is not MDIChild this codes run correct. But when my form is MDIChild
this codes show MDIParents name.
How can I show parent form name (not MDIParent)
public class MyButton: System.Windows.Forms.Button{
{
....
protected override void OnClick(EventArgs e)
{
if (this.TopLevelControl is Form)
{
Form Form_ = (Form)this.TopLevelControl;
MessageBox.Show(Form_.Name);
}
base.OnClcik(e

}
....
}