Re: Can not get dialog's ParentForm?? by haiwen
haiwen
Fri Jul 16 09:43:01 CDT 2004
Hello, Shakir and Lloyd:
Thank you for your reply.
For MDI form, "myChild.MdiParent = this" does work, but my problem is I can not get the parentForm from the dialog. Even I try follow:
dialog d=new dialog();
d.ShowDialog(this); //it seems this is owner,not parentForm
from the dialog form:
if(this.ParentForm==null )
still true, of course, this.Owner is not equal null.
I just wonder why ParentForm does not work in dialog?
Thanks again.
Sincerely,
Haiwen
this.
"Shakir Hussain" wrote:
> ParentForm will return the parent of MdiChild forms
>
> Form myChild = new Form();
> myChild.MdiParent = this;
>
> Inside myChild Form you can get parent form.
>
> string parentname = myChild.ParentForm.Name
>
> --
> Shak
> (Houston)
>
>
> "haiwen" <haiwen@discussions.microsoft.com> wrote in message
> news:7AD522CD-6FED-4886-8109-54962614423A@microsoft.com...
> > Hello, everyone:
> >
> > I have a dialog form need to initial some data from its ParentForm, but I
> can not get its ParentForm. what I have done is:
> >
> > when I click one button1 on Form1, it does:
> > {
> > dialog d=new dialog();
> > d.ShowDialog();
> > }
> >
> > in the Dialog form, after initialize the components, even I check its
> ParentForm
> > if(this.ParentForm==null)
> > {
> > MessageBox.Show("no parent form");
> > }
> >
> > I always get "no parent form".
> >
> > Could anyone tell me what's wrong I have done?
> >
> > Sincerely,
> >
> > Haiwen
>
>
>