none
Using Child Forms

    Question

  • I am trying to create a project that has a main MDI form with a menu.

    The menu items call child forms.

    I am trying to make the child forms (Each for a different master) call a simple "grandchild" form, which presents a groupbox with three options: "ADD", "MODIFY", "DELETE", and return the selected option to the child form. The child form will then present to the user the required fields.

    The call is thru Grandchildform.show() in the childform_load event.

    When I execute the project: the Grandchild form is briefly displayed, but does not wait for interaction, but returns to the child form.

    The"Grandchild" has nothing but the group of three radio buttons.

    I tried to make the "Child" form a MDI form, but the "Grandchild" never waits for user interaction.

    I am not sure what I am missing.

    Will be glad if I could find out where I am going wrong

    Mohan


    MohanSQL


    Friday, December 27, 2013 7:33 AM

Answers

All replies

  • It appears the Grandchilld form l exists, but is behind the child form.

    MohanSQL

    Friday, December 27, 2013 9:02 AM
  • Hi MohanSQL,

    I am moving your thread into the Windows Forms General  Forum for dedicated support. Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 30, 2013 5:14 AM
  • Maybe you should use ShowDialog() instead of Show().
    Monday, December 30, 2013 5:12 PM
  • Hi MohanSQL,

    I agree with Viorel_ that if you use model dialog(ShowDialog) the form Grandchild will show. Please check if it is what you need. If you needs some others, you may need to share your code sample.

    Regards,



    Barry Wang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 8:19 AM
  • Mohan,

    Can you explain what is a grandchildform. 

    A MdiContainer can only have mdichilds (but that are normal forms showed in and under control of a mdi container).

    Beside that you can show modal dialogs but that are in fact no grandchildform.

     


    Success
    Cor


    Tuesday, December 31, 2013 10:59 AM
  • Oh: I created a MDIform with a menu that calls a child form: and I wanted the child form to call a form which should hide the first child until it was dispose() ed: this I called a grandchild.

    Wonder if I make sense: : I am learning.

    Thanks

    Mohan


    MohanSQL

    Tuesday, December 31, 2013 11:29 AM
  • With MDIForms is the easiest way to hide and show them from the MDIChildren array in the MDIContainer


    Take a look at this page and the sample in it.

    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.mdichildren(v=vs.110).aspx

    In that sample loop you can test for the form names and then hide or show them if they are in that container.

    You can find that MDI from andy MDIChild using the property

    http://msdn.microsoft.com/en-us/library/system.windows.forms.form.mdiparent(v=vs.110).aspx

    (You need some casting for that to use it from your child, Quick and dirty done as bellow)

     Dim theParentForm = DirectCast(MdiParent, TheParentFormClass)


    Success
    Cor

    Tuesday, December 31, 2013 11:49 AM