1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MDI and Split Container

Discussion in 'Scripting & Programming' started by ThomasMc, Sep 17, 2007.

  1. ThomasMc

    ThomasMc Gigabyte Poster

    1,507
    49
    111
    Hi everyone got a little order system that am currently doing , but hit a little problem

    1x MDI Parent Form
    1x Split Container

    in the split container, Panel1 is my menu(as seen in pic) and Panel2 is where i want the child form to be docked this is the part I'm having the problem with it keeps opening the child form behind the split container(which inturn completely hides the child form from users view) , anyone done this before that could maybe give me an insight on how to achieve this.



    VB.NET and VS2005
     

    Attached Files:

    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)
  2. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    I dont think you can do it they way you are attempting to. With an MDI parent/child situation, each form looks like a separate window (Think of different files in word/excel), with the splitcontainer, each container contains one or more controls (A form is a toplevel control which doesnt appear to be incompatible with the panels.

    What you need to be doing, is: Rather than creating forms, create new 'user controls'. then you can add a control into the panel by using:

    Code:
    splitcontainer1.panel2.add(New usercontrol1)
    
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  3. ThomasMc

    ThomasMc Gigabyte Poster

    1,507
    49
    111
    Hi Fergal TY for your speedy response, not done any work with the user controls as of yet so here come my silly question, can i treat it like a form ie have TB,Combox, click everts etc etc so it would resemble some sort of User Input Form?
     
    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)
  4. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    Absolutley. User controls are basically forms, but without the header bar (with the window close button). I believe its a little more complicated than that, but thats how i think of it.

    Just remember that a user control doesnt really have a fixed size, but resize to fit the container they are loaded into. So be sure to lay your control in the correct manner, and anchor controls as you need.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  5. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    Taking a brief look around, User controls are typically designed to allow you to create custome controls (such as a round button), rather than creating an entire form in this manner).

    However, my first VB.Net book used this method to do exactly what you are trying to achieve, and ive tested it out so i know it works.

    If theres a more appropriate measure available, Im not aware of it, and the guys at work here havent mentioned it when i asked. But if there is, Im sure someone else will be along shortly to enlighten the pair of us.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  6. ThomasMc

    ThomasMc Gigabyte Poster

    1,507
    49
    111
    Tried, Tested, Job Done - even if theres is another way of doing it Fergal this is exactly what I'm looking for and you have teached me something in the process so Kudos added :)
     
    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)
  7. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    No problem. Its worth pointing out that you should really clear the panel before loading another control into it, just to be neat:

    Code:
    SplitContainer1.Panel2.Clear
    
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  8. ThomasMc

    ThomasMc Gigabyte Poster

    1,507
    49
    111
    Noted Thanks again
     
    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)

Share This Page

Loading...