Results 1 to 5 of 5

Thread: [RESOLVED] MDI Child Problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Resolved [RESOLVED] MDI Child Problem

    Dear Friends,

    Now I want to make a form child of another form that is mdiContainer.How can I do that?

    Rajib
    Last edited by Hack; Apr 3rd, 2006 at 06:54 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark
    Please Rate every reply if it is useful to u

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: MDI Child Problem

    If Form1 is the MDI Parent then set the isMDIContainer property of the Form to True. Now if Form2 will act as a MDIChild, then you can use this code
    Code:
    			Form2 newForm = new Form2();
    			newForm.MdiParent = this;
    			newForm.Show();
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: MDI Child Problem

    Dear Shuja,

    Thanks for quick response. But I want that if child is open then parent must be inactive. here when the child is open the total application can be closed by clicking on close button of parent. But don't want that. i want that user must close child before close total application.

    Can anybody help me ?

    Rajib
    Please Rate every reply if it is useful to u

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

    Re: MDI Child Problem

    What's the difference between closing the child and then the parent or just closing the parent? When you close the parent it raises an event in the child so you can prompt the user then to save any pending changes or whatever. If you really want to prevent the user closing the parent then you're going to have to handle that situation in the parent. Strictly speaking you should disable all the means of closing the parent, like menus, toolbars, titlebar, etc. Alternatively you could just handle the Closing (2003) or FormClosing (2005) event and cancel it if the child is open, but that is less professional. I really can't see a reason to prevent the parent closing though. I've never seen an app that does that. usually they just do as I suggested and prompt the user to save any pending changes before closing.
    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
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: MDI Child Problem

    Thanks for ur valuable suggetion. I was just confused. But u realy make me free. Thanks again.

    Rajib
    Please Rate every reply if it is useful to u

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