Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
2.00/5 (1 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.

VB
 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

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
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900