VB.Net 2010 Managing MDI forms

Posted on 2011-10-20
Last Modified: 2012-06-27
I have an application that allows multiple MDI children to be opened at a time.  I added a button  to each to allow them to be "un-docked" or "emancipated" from the MDI parent, in case the user wants to move it to another part of the screen or re-size it outside of the MDI container form.  To do this I set Me.mdiparent=Nothing on the Child form.

This works fine.  

I also added a button to "move back in" with the parent form.  Basically, re-establish the MDI relationship.

I simply set Me.MdiParent=frmParent.  This appears to work and sometimes does OK.  But more often than not, the program soon crashes with the following error message:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Am I trying to do something that can't be done?

If it can be done, how do I code the two moves?

If not, any suggestions as to working around the problem?

Question by:lweekly
    LVL 85

    Accepted Solution

    I can't seem to reproduce the error.  Can you show some more code and/or a screencast of the error occurring?

    Author Closing Comment

    The problem was actually with a COM control on the form.  Once I got an updated version of it, all was OK.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    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…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    733 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

    20 Experts available now in Live!

    Get 1:1 Help Now