VB.Net 2010 Managing MDI forms

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?

Who is Participating?
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
I can't seem to reproduce the error.  Can you show some more code and/or a screencast of the error occurring?
lweeklyAuthor Commented:
The problem was actually with a COM control on the form.  Once I got an updated version of it, all was OK.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.