Solved

MDI Form with a ToolStripContainer

Posted on 2010-11-08
11
3,162 Views
Last Modified: 2012-05-10
I Have a MDI Parent form using a ToolStripContainer. I finially have the container working woth the tool bars, but now as I attempt to get the child forms created, they do not display. If I make the ToolStripContainer visible equal to false, then the child form appears. So it appears that the child form is behind the ToolStripContainer. I atetmpted to dock the ToolStripContainer but this did not help. I was not able to get tool bars to dock without the use of the ToolStripContainer so how can I get all of this to work?
0
Comment
Question by:fundsf
  • 5
  • 5
11 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34088065
"I was not able to get tool bars to dock without the use of the ToolStripContainer so how can I get all of this to work?"

A ToolStripContainer is designed to take up the ENTIRE container area which is why your MdiChildren are not visible.

Remove the ToolStripContainer and a standard Toolstrip should Dock across the Top of your MdiParent.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34088067
If that doesn't help then please elaborate on what you're attempting to build.  A picture might be helpful in showing what does or does not work...
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 34088112
You need to add the MDI children to the ContentPanel, not the Parent form...

    ToolStripContainer1.ContentPanel.Controls.Add(ChildForm)

Wayne
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34088163
If you're going to do as Wayne suggests, you must first set the TopLevel() property of your children to False:

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click

        Dim child As New frmChild

        child.TopLevel = False

        ToolStripContainer1.ContentPanel.Controls.Add(child)

        child.Show()

    End Sub

Open in new window

0
 

Author Comment

by:fundsf
ID: 34095304
Thanks, but thoise suggestions did not seem to help. I applied them to my code (below) without any luck.

Private Sub MenuTools_Options_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                    Handles MenuTools_Options.Click
Try
            Dim LoadIt As Boolean = True

            For Each frm As Form In Me.MdiChildren
                       If frm.Name.ToLower = "frmoptions" Then
                               LoadIt = False
                               Exit For
                      End If
            Next

             If LoadIt Then
                        Dim frm As New frmOptions
                                     ' Me.ToolStripContainer1.Visible = False      (IF I TURN THIS OFF THE FORM IS VISIBLE BEFORE THE SUGGESTION)
                        If My.Settings.MenuView_ToolBars_Visible Then
                                   frm.TopLevel = False
                                   Me.ToolStripContainer1.ContentPanel.Controls.Add(frm)     '  (DOING THIS NOW STILL DOES NOT SHOW THE FORM)
                        Else
                                   frm.MdiParent = Me
                       End If

                       frm.Show()
             Else
                       For Each childForm As Form In Me.MdiChildren
                                   If TypeName(childForm).ToLower = "frmoptions" Then
                                              childForm.Activate()
                                               Exit For
                                  End If
                       Next
            End If
Catch ex As Exception
                MsgBox("Unable to open the requested form. The problem was:" & vbCr & vbCr & ex.Message)
End Try

End Sub
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34095321
Please post a screen shot of your form...

Better yet, zip up the project and change the extension to .txt so you can upload it here.
0
 

Author Comment

by:fundsf
ID: 34095417
Okay. Here is the image. This is VB.Net 2010.
OptionFormNotVisiblewithToolStri.JPG
0
 

Author Comment

by:fundsf
ID: 34095431
Part two with the form seen and the ToolStripContainer not Visible.
OptionFormVisiblewithToolStripCo.JPG
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 34095498
You can't mix the MdiParent/MdiChildren approach with the ToolStripContainer....it just won't work.

You can achieve a similar setup using a standard MdiParent by simply changing the Dock() property of the controls to Top/Bottom/Left/Right:
MdiParentWithDockedToolBars.jpg
0
 

Author Comment

by:fundsf
ID: 34095553
So the shown child tool bars need to be docked individually? How would this be done so that the user can move them to a different location? Also, when docking at the bottom, and I have a status bar, would the tool bar be above the status bar? Also, would this allow floating tools bar somehow?
 
Can you provide an example in VB>Net?
 
Thank
0
 

Author Closing Comment

by:fundsf
ID: 34096859
Thanks, I found my question on the net.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tabcontrol Caption? 1 30
Form design in vb.net 7 34
Get Count in a variable with 5 digits always 1 28
VS.net 2010 11 23
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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now