Results 1 to 8 of 8

Thread: [2008] MDI and Child Forms

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fox, OK
    Posts
    381

    [2008] MDI and Child Forms

    In VB6, MDI applications were possible. You'd create a form and a few Child forms and go with it.

    I'm pretty sure this is still a possibility in VB2008 but where is it?

  2. #2
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008] MDI and Child Forms

    You have to create an MDI Parent form and one or several MDI Child forms.

    You can create an MDI Parent form by setting your form's "IsMdiContainer" property to True.
    Alternatively, you can create a new mdi parent form complete with menubar and toolbar with default options (new/open/save, cut/copy/paste etc etc) by selecting a "MDI Parent Form" from the "Add New Item" dialog box (when you choose "Add - New Item" to add a new form).

    An MDI Child form is a normal form like every other. The difference is in the way you show it.
    In the MDI Parent form, you have to set the form's "MdiParent" property to your parent form.

    For example, this code goes in the parent form, and the mdi child form is called "Form1":
    vb.net Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Form1.MdiParent = Me
    3.         Form1.Show()
    4.     End Sub

  3. #3
    Member
    Join Date
    Sep 2006
    Posts
    53

    Re: [2008] MDI and Child Forms

    usefull

  4. #4
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2008] MDI and Child Forms

    Quote Originally Posted by DroopyPawn
    In VB6, MDI applications were possible. You'd create a form and a few Child forms and go with it.

    I'm pretty sure this is still a possibility in VB2008 but where is it?
    Hi,

    Here's the explaination how to create a MDI form with VB 2008 also how to create Childforms.


    http://msdn2.microsoft.com/en-us/library/d4dabts7.aspx

    Hope it helps,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fox, OK
    Posts
    381

    Re: [2008] MDI and Child Forms

    I found some pretty good info in the VB2008 help last night. Thanks for responding.

  6. #6
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: [2008] MDI and Child Forms

    OK, I'm an idiot. But, implementing MDI in VS2008 is not nearly as easy as it was in VB6.

    Code:
    Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim LoginForm As New LoginForm1
            LoginForm.Show()
        End Sub
    I have the MDI form all set up as a MDI Parent. On form load, I want the login screen to show (in the MDI form). The MDI form shows, but no login screen in it.

    I have been Googling and looking at a VB2005 book that I have and it still does not make sense to me.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  7. #7
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: [2008] MDI and Child Forms

    OK, I changed the MDI Parent form load to this:
    Code:
    Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            LoginForm1.Parent = Me
            LoginForm1.Show()
        End Sub
    Now I get the error "A top level control cannot be added to a control"
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  8. #8
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: [2008] MDI and Child Forms

    OK. got it. I needed to set the MDIParent not Parent
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

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