[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

vb.net Mdi Forms

Posted on 2007-03-25
7
Medium Priority
?
400 Views
Last Modified: 2012-06-21
I have 2 forms - 1 mdiparent and other one mdichild
i open mdi child forms with the click event of a button in mdi parent
the coding which i am using to open mdichild is
in General delaration part
dim childform as form2
in button click
childform=new form2
childform.mdiparent=me
childform.bringtofront
childform.show()

My question is when the child form opens i am still able to see the button in form1 that is mdi parent
is there any solution for this the form1 button shouldnt be seen and i can open child form only through
button
0
Comment
Question by:pearlym
[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
7 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 18787977
see my article http://www.emoreau.com/Entries/Articles/2003/09/Fun-with-MDI-forms.aspx in which you will find a method IsChildInMemory that will help you finding if the form is already visible or not (instead of hiding the button, you can prevent the form from appearing twice)..
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18788553
You can also declare your childform as WithEvents and reset your variable when the form closes:

Public Class MdiParent

    Private WithEvents childForm As Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If childForm Is Nothing Then
            childForm = New Form2
            childForm.MdiParent = Me
        End If
        If childForm.WindowState = FormWindowState.Minimized Then
            childForm.WindowState = FormWindowState.Normal
        End If
        childForm.Show()
    End Sub

    Private Sub childForm_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles childForm.Closed
        childForm = Nothing
    End Sub

End Class
0
 

Author Comment

by:pearlym
ID: 18790719
Still the parent form button is visible even when the child form is active
I tried all the methods
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 200 total points
ID: 18790777
So you just want the Button invisible while the form is active?

How about?...

Public Class MdiParent

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.Visible = False
        Dim cf As New Form2
        cf.MdiParent = Me
        AddHandler cf.Closed, AddressOf cf_Closed
        cf.Show()
    End Sub

    Private Sub cf_Closed(ByVal sender As Object, ByVal e As System.EventArgs)
        Button1.Visible = True
    End Sub

End Class
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 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