load multiple forms into main form

Posted on 2006-05-26
Last Modified: 2012-05-05
is there a way with a panel or something to load forms into my main form

looking for a way to build individual forms and then load them into my main form when a menu option is selected
Question by:tpiazza
    LVL 5

    Expert Comment

    like a web usercontrol for but in winforms?  if you really want to get crazy w/ it, build custom controls homey.  then do  a visible invisible call.

    However, i think the right answer is somewhat different.  Look at every major windows application you have ever used.  Did they implement window in window... no not really.  The windows application model is a dialog box model.  Where an application when needing further information will open a dialog and get its special data that way.  think of print preview, or save file etc.  these are complicated little buggers that get their own window who has control of the application only when he is needed.


    Author Comment

    so instead of forms make them usercontrols?
    LVL 5

    Expert Comment

    right.  but, again i'd suggest, changing the model all together...  its like your trying to do web programming in the windows arena.  which where i'm from is a big no no...  but where youre from it may not be, so yes goto a usercontrol model

    Author Comment

    well im building an application with about 18 different forms -- want it to be seamless when they click on something-- all the forms are completely different

    dont want to have to turn lots of controls on and off when they click on something -- any suggestions besides a usercontrol


    how do i add the control at runtime?
    LVL 5

    Expert Comment

    personally, i use visible invisble and put them all on the form w/ a default setting.  Then create a method that toggles.
    LVL 85

    Accepted Solution

    Use a TabControl.

    Here is an example of loading a form into a new TabPage in a TabControl:

            Dim sf As New SpeedoForm
            sf.FormBorderStyle = FormBorderStyle.None
            sf.TopLevel = False
            sf.Visible = True
            sf.Dock = DockStyle.Fill

            Dim tp As New TabPage

    LVL 5

    Expert Comment

    Try this:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now