Solved

vb.net child form

Posted on 2004-09-28
6
850 Views
Last Modified: 2012-06-27
I havew a mdiparent form and I want to make all other forms inside that parent form. I used this before

dim form2 as new form2
form2.mdiparent = mdiparent.activeform
form2.show



the problem is lets say I have 3 forms
mdiparent, form2, form3

and I have form2 open inside using the above code. Now I have a button on form2 that will open form3 how do u do that. It seems to act wierd and I understand why. The reason is because the mdiparent activeform at the time is form2.

what is the right way to do this


0
Comment
Question by:hogan9111
[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
  • 3
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 35 total points
ID: 12173486
From mdiParent:

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim f2 As New Form2
        f2.MdiParent = Me
        f2.Show()
    End Sub

From Form2:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim f3 As New Form3
        f3.MdiParent = Me.MdiParent
        f3.Show()
    End Sub
0
 
LVL 4

Expert Comment

by:ndegioia
ID: 12179388
Idle Mind is correct.  All you have to do is identify which form you wan to be its parent.  In the case above it is done with the  fe.Mdiparent = Me.Mdiparent  The Me.Mdiparent is placing the scope back to the mdi parent form and not form2.

Hope this helps.
0
 

Author Comment

by:hogan9111
ID: 12217603
could you also do this

  Dim Form3As New Form3
  Form3.MdiParent = Me.MdiParent
  Form3.Show()
if not why


wouldn't me represent the current form open??
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12217733
Me represents the current encompassing class.  It is possible to execute code in a form via events without that form having the focus.

In this case, that would work if the MdiParent property was properly set for Form2.

~IM
0
 

Author Comment

by:hogan9111
ID: 12289417
ok but when I have form2 maximize and I go to call form3 that is not suppose to be it makes it maximize, I have the form setting for fixed, centerscreen. Now if I make form2 not maximize and call for 3 it works properly. What can I do
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12289458
That is a "by design issue" with MDI child forms that you just have to live with.  If one MDI child is maximized, then all MDI children are maximized.  Likewise, if one MDI form is "restored" (not maximized) then all MDI children are restored.

Sorry,

Idle_Mind
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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

729 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