Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vb.net child form

Posted on 2004-09-28
6
Medium Priority
?
856 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 140 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

670 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