Results 1 to 5 of 5

Thread: [RESOLVED] set a mdi child form from another mdi child form

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2007
    Location
    Sweden
    Posts
    50

    Resolved [RESOLVED] set a mdi child form from another mdi child form

    Hi
    Im opening a mdi child form to the mdi container form
    and in that child form the user can select a number of pictures
    and from that child form I want to open the pictures in a nother child form that shows the image.
    But I cant get it to be a child to the mdi container form??

    Code:
    ChildForm frm = new ChildForm();
    
    ChildForm.Parent = This; // Here its always This maybe heres my problem??
    Can anyone help me with this please? I think Im going nuts...

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: set a mdi child form from another mdi child form

    Think about it. You want the new form to have the same parent as the current form, right? How did you set the current form's parent in the first place? You assigned the appropriate form to its MdiParent property, right? So, where do you think you should get its parent from?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2007
    Location
    Sweden
    Posts
    50

    Re: set a mdi child form from another mdi child form

    Thanks
    Took me a few hours and I can't believe I dident get it!

    Code:
    childForm.MdiParent = ParentForm;

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] set a mdi child form from another mdi child form

    That's still not it. It's simply:
    csharp Code:
    1. newForm.MdiParent = this.MdiParent
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2007
    Location
    Sweden
    Posts
    50

    Re: [RESOLVED] set a mdi child form from another mdi child form

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width