Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-05
4
Medium Priority
?
514 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 100 total points
ID: 12227330
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 100 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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 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