Click here to Skip to main content
14,209,465 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, just would like to ask if someone encountered the same problem with mine. I have created a vb.net application using 5 forms which form1 is the parent form and the other 4 is the child. I already included all the codes necessary to handle the child forms and it is doing fine but when i created a menu to control the child forms the problem is when i close one of the child form then click the menu to activate the form again, there is no result. The menu is only good at closing but not on showing.

Here is the code.

 Public mw As Form2 = New Form2
    Public calc As Form3 = New Form3
    Public curr As Form4 = New Form4
    Public res As Form5 = New Form5
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.IsMdiContainer = True

        mw.Owner = Me
        calc.Owner = Me
        curr.Owner = Me
        res.Owner = Me

        mw.MdiParent = Me
        calc.MdiParent = Me
        curr.MdiParent = Me
        res.MdiParent = Me

        res.Show()
        curr.Show()
        calc.Show()
        mw.Show()

 Me.LayoutMdi(MdiLayout.TileVertical)
End Sub

 Private Sub SampleMenuMW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SampleMenuM.Click
        If mw IsNot Nothing Then
            mw.Close()
        Else
            mw.Show()
        End If
    End Sub


Thank you very much.
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].

I can explain what to do instead. Please see my past answers:
Why MDI form is not supported natively in WPF ?[^],
How to Create MDI Parent Window in WPF? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190617.3 | Last Updated 18 Jun 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100