Solved

Make MDI Parent open only one (same) MDI Child form

Posted on 2004-10-05
4
512 Views
Last Modified: 2011-09-20
hi Experts,

i want to ask How to make MDI Parent open only one (same) MDI Child form?
so it will like in VB6 where i can only open one MDI Child form...
i will need to close the opened MDI child form first if i want to open the same MDI child form again
Note: i will still be able to open different MDI child forms

thanks in advance
0
Comment
Question by:Axpress
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 25 total points
ID: 12227330
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 25 total points
ID: 12227569
You need to loop thouch the MDIChildren collection to find if an instance of a particular child is already loaded.

    Private Function IsChildInMemory(ByVal pChildName As String) As Boolean
        'A small method that checks to see if a particular form is currently displayed as a child form
        Dim frmChild As Form
        For Each frmChild In Me.MdiChildren
            If TypeName(frmChild).ToUpper = pChildName.ToUpper Then
                frmChild.Activate()
                Return True
            End If
        Next
        Return False
    End Function

Then you can use this code:

If Not IsChildInMemory("frmChild2") Then
    Dim frm As New frmChild2()
    With frm
        .MdiParent = Me
        .Show()
        '.Dock = DockStyle.Fill
    End With
End If
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12228613
lol...emoreau...the link I posted is your solution.

~IM
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12228946
seems that you agree with it!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question