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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. MDI parent MDI child issue

MDI parent MDI child issue

Scheduled Pinned Locked Moved C#
helpdatabasedocker
11 Posts 4 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 gerrybrennan

    Hi I have an app with its main form MAIN which is an mdi container. One of the options from this MAIN is to show a database record in a new dialog (DIALOG_A). This new dialog is a mdi child and its mdiparent is MAIN. Now another operation that MAIN can perform is to create another new dialog (DIALOG_B). This also is a child mdi and its mdiparent is MAIN. However, from DIALOG_B .... i would like to call DIALOG_A also. I am getting problems however becuause Dialog_A is not an MDI container. Could some one suggest some help. Thank you very much.

    D Offline
    D Offline
    dan sh
    wrote on last edited by
    #2

    Does call means opening the form? If you can show some code it would be better. Although you can create the instance of form A and open it using Show method. You can set it's MDI parent as the Main form like this:

    FormA frmA = new FormA();
    frmA.MDIParent = this.MDIParent;
    frmA.Show();

    This code would come in the FormB and MDIParent of the FormB should be MainForm.

    It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

    G 1 Reply Last reply
    0
    • G gerrybrennan

      Hi I have an app with its main form MAIN which is an mdi container. One of the options from this MAIN is to show a database record in a new dialog (DIALOG_A). This new dialog is a mdi child and its mdiparent is MAIN. Now another operation that MAIN can perform is to create another new dialog (DIALOG_B). This also is a child mdi and its mdiparent is MAIN. However, from DIALOG_B .... i would like to call DIALOG_A also. I am getting problems however becuause Dialog_A is not an MDI container. Could some one suggest some help. Thank you very much.

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #3

      Could you please clarify:

      gerrybrennan wrote:

      from DIALOG_B .... i would like to call DIALOG_A

      Does this mean you wish to be able to create a new Dialog_A from Dialog_B, or do you want to Call some function in Dialog_A from Dialog_B?

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      G 1 Reply Last reply
      0
      • D dan sh

        Does call means opening the form? If you can show some code it would be better. Although you can create the instance of form A and open it using Show method. You can set it's MDI parent as the Main form like this:

        FormA frmA = new FormA();
        frmA.MDIParent = this.MDIParent;
        frmA.Show();

        This code would come in the FormB and MDIParent of the FormB should be MainForm.

        It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

        G Offline
        G Offline
        gerrybrennan
        wrote on last edited by
        #4

        Hi .. Yes call means -> Instanciate the form. Thank you.

        D 1 Reply Last reply
        0
        • H Henry Minute

          Could you please clarify:

          gerrybrennan wrote:

          from DIALOG_B .... i would like to call DIALOG_A

          Does this mean you wish to be able to create a new Dialog_A from Dialog_B, or do you want to Call some function in Dialog_A from Dialog_B?

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          G Offline
          G Offline
          gerrybrennan
          wrote on last edited by
          #5

          Yes -> Does this mean you wish to be able to create a new Dialog_A Thank you.

          H 1 Reply Last reply
          0
          • G gerrybrennan

            Hi .. Yes call means -> Instanciate the form. Thank you.

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #6

            In that case the code I had posted should work for you. Or it does not?

            It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

            G 1 Reply Last reply
            0
            • G gerrybrennan

              Yes -> Does this mean you wish to be able to create a new Dialog_A Thank you.

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #7

              If the code from d@nish does not work, please come back, and I will try to help you.

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              G 1 Reply Last reply
              0
              • D dan sh

                In that case the code I had posted should work for you. Or it does not?

                It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

                G Offline
                G Offline
                gerrybrennan
                wrote on last edited by
                #8

                Hi ... Your solution does work. Many Thanks. Regards. Gerry.

                1 Reply Last reply
                0
                • H Henry Minute

                  If the code from d@nish does not work, please come back, and I will try to help you.

                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                  G Offline
                  G Offline
                  gerrybrennan
                  wrote on last edited by
                  #9

                  Thank you also Henry Gerry.

                  1 Reply Last reply
                  0
                  • G gerrybrennan

                    Hi I have an app with its main form MAIN which is an mdi container. One of the options from this MAIN is to show a database record in a new dialog (DIALOG_A). This new dialog is a mdi child and its mdiparent is MAIN. Now another operation that MAIN can perform is to create another new dialog (DIALOG_B). This also is a child mdi and its mdiparent is MAIN. However, from DIALOG_B .... i would like to call DIALOG_A also. I am getting problems however becuause Dialog_A is not an MDI container. Could some one suggest some help. Thank you very much.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #10

                    Are you saying that you want MAIN to launch a new form, DIALOG_B, and make it an MdiChild of MAIN, then DIALOG_B creates a new instance of DIALOG_A and make it an MdiChild of DIALOG_B??? You can't do that. An MdiChild form cannot also be an MdiParent at the same time.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008
                    But no longer in 2009...

                    G 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Are you saying that you want MAIN to launch a new form, DIALOG_B, and make it an MdiChild of MAIN, then DIALOG_B creates a new instance of DIALOG_A and make it an MdiChild of DIALOG_B??? You can't do that. An MdiChild form cannot also be an MdiParent at the same time.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008
                      But no longer in 2009...

                      G Offline
                      G Offline
                      gerrybrennan
                      wrote on last edited by
                      #11

                      Ok

                      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