I found it is very easy to put a form inside another form, which can be very handy if you want to use some forms that have duplicate parts on them, but have some differences. Visual Inheritence can be used as well, but sometimes that is not so easy to implement, and this method allows you to easily put the embedded form anywhere on the master form.
I found it is very easy to put a form inside another form, which can be very handy if you want to use some forms that have duplicate parts on them, but have some differences. Visual Inheritence can be used as well, but sometimes that is not so easy to implement, and this method allows you to easily put the embedded form anywhere on the master form.
well the form is technically a control (it inherits from control) so you can add a form to a container control's controls collection.
You need to set the embedded forms TopLevel property to false, so it does not register as a top level form (this allows it to be placed in another control)
I imagine you could use it for a dock window system
I have also found (through playing around) that if the form you are embedding in the master form is NOT in the same project (but in a reference, like a class library), you need to change the scope of the controls you want to expose from friend to public. If the form is in the same project (as in the example I uploaded) Friend is ok as the modifier.
true. I am actually using this method in an app I am working on, so as I get a little further in, I will work out any fine details that I should include and post it there. It is pretty cool, and while it is very basic, I was really happy to see it was possible, it never was in VB6 without using a bunch of APIs that never would allow the window to act right anyway.