Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. mdi child problem

mdi child problem

Scheduled Pinned Locked Moved Visual Basic
helpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GaryKoh
    wrote on last edited by
    #1

    hi.. i have make 3 forms 1 mdi parent and 2 mdi child calling a child to show at parent is easy but hoow to make a child call another child and show it in the parent? this is basically how it look like.. form1(parent) call form2(child)....form2 show in form1 form2(child) call form3(child).....form3 show in form1 i try to code the button in form2 like so Dim frm3 as New Form3 Dim frm1 as New Form1 frm3.mdiparent = frm1 frm3.show which is not working...am i doing it wrong? please help me...thank you in adnvace Gary

    O 1 Reply Last reply
    0
    • G GaryKoh

      hi.. i have make 3 forms 1 mdi parent and 2 mdi child calling a child to show at parent is easy but hoow to make a child call another child and show it in the parent? this is basically how it look like.. form1(parent) call form2(child)....form2 show in form1 form2(child) call form3(child).....form3 show in form1 i try to code the button in form2 like so Dim frm3 as New Form3 Dim frm1 as New Form1 frm3.mdiparent = frm1 frm3.show which is not working...am i doing it wrong? please help me...thank you in adnvace Gary

      O Offline
      O Offline
      OICU812
      wrote on last edited by
      #2

      Try this:

      Public Class Form1

      Private Sub Form1\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          Dim frm2 As New Form2
          frm2.MdiParent = Me
          frm2.Show()
      End Sub
      

      End Class

      Public Class Form2

      Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          Dim frm3 As New Form3
          frm3.MdiParent = Me.ParentForm
          frm3.Show()
      End Sub
      

      End Class

      G 1 Reply Last reply
      0
      • O OICU812

        Try this:

        Public Class Form1

        Private Sub Form1\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim frm2 As New Form2
            frm2.MdiParent = Me
            frm2.Show()
        End Sub
        

        End Class

        Public Class Form2

        Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim frm3 As New Form3
            frm3.MdiParent = Me.ParentForm
            frm3.Show()
        End Sub
        

        End Class

        G Offline
        G Offline
        GaryKoh
        wrote on last edited by
        #3

        tried....but this error show up An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication7.exe Additional information: Object reference not set to an instance of an object. and still unable to show the second child Gary

        R O 2 Replies Last reply
        0
        • G GaryKoh

          tried....but this error show up An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication7.exe Additional information: Object reference not set to an instance of an object. and still unable to show the second child Gary

          R Offline
          R Offline
          Robert Rohde
          wrote on last edited by
          #4

          Try Owner instead of ParentForm. ParentForm gets the form on which a control is placed. Owner should get (if I remember right) the owning form of a child form.

          1 Reply Last reply
          0
          • G GaryKoh

            tried....but this error show up An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication7.exe Additional information: Object reference not set to an instance of an object. and still unable to show the second child Gary

            O Offline
            O Offline
            OICU812
            wrote on last edited by
            #5

            I'm sorry Gary, I tested my previous example on VisualBasic 2005 Beta and it works there. You're right it does produce an error on my VS 2003. I tested this on VS 2003 and it works.

            Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim frm3 As New Form3
            frm3.MdiParent = Me.MdiParent
            frm3.Show()
            End Sub

            G 1 Reply Last reply
            0
            • O OICU812

              I'm sorry Gary, I tested my previous example on VisualBasic 2005 Beta and it works there. You're right it does produce an error on my VS 2003. I tested this on VS 2003 and it works.

              Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
              Dim frm3 As New Form3
              frm3.MdiParent = Me.MdiParent
              frm3.Show()
              End Sub

              G Offline
              G Offline
              GaryKoh
              wrote on last edited by
              #6

              Thanks OIC is working now thank for all the help....both of u thank you Gary

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups