Results 1 to 2 of 2

Thread: [RESOLVED] parent and child forms

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    534

    Resolved [RESOLVED] parent and child forms

    Hello
    I have two forms (form1,form2) I set the properties of form1 to: window state > maximized , ismdicontainer > true .I then put the code into the form1_load subroutine [CODE]Dim NewMDIChild As New Form2()
    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim NewMDIChild As New Form2()
            'Set the Parent Form of the Child window.
            NewMDIChild.MdiParent = Me
            'Display the new form.
            MsgBox("parent")
            NewMDIChild.Show()
        End Sub
    I also put the following into form2_load subroutine
    Code:
    Public Class Form2
        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            MsgBox("child")
        End Sub
    End Class
    This in fact works. What I need to do is make form2 the parent and form1 the child. I have changed the forms properties so that form 2 is the parent and form1 is the child.
    What I want is when the program runs is for form2 to automatically show the message " child " followed by form1 showing the message "parent"
    It seems simple to do, but I have had no luck. Thanks in advance!

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    534

    Re: parent and child forms

    yes I forgot to change which form to start with. I almost got it to work the way I want. Thank you

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