Link to home
Start Free TrialLog in
Avatar of brokeMyLegBiking
brokeMyLegBiking

asked on

load a form within a form

Is there a way to load a form within a form. Say forexample, load a form within a panel?

I would like to be able to keep by code in separate forms, but I dont want to show the navigation controls for each form when I embed it in my main form.


Joseph
SOLUTION
Avatar of heintalus
heintalus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another way is to make a Inherited Form, the parent form will contain the general functionality and the child form can have child functionality, but the controls of both the forms will be visible
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of iboutchkine
iboutchkine

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim f As New Form2()
        f.TopLevel = False
        Me.Controls.Add(f)
'f is in coordinates of form1
        f.Left = 0
        f.Top = 0
        f.Show()
        f.BringToFront()
    End Sub
Avatar of brokeMyLegBiking

ASKER

heintalus , SoMoS,

Your answers are BRILLIANT,BRILLIANT,BRILLIANT,BRILLIANT,BRILLIANT,BRILLIANT,BRILLIANT,BRILLIANT,BRILLIANT!!!!! This is great, your two solutions very much solves my problem. I have lost a lot of sleep over this! Now I can have my cake and eat it too! And the best part, they are very easy.

Question: What is the easiest way to convert a form to a userControl? Why do you need to set "topLevel" to false?

-brokeMyLegBiking



SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you are right, I love the answer. :D
Ops, I forgott one question:

'A TopLevel form is the one that hasn't a main form or the one that has as main form the desktop. The toplevel forms are used as the main form of the application. So to use it, the property has to be set to false because the form has a main form (f1).

SoMoS

P.D: Come'on with the points brother!
thanks again folks!