C# - Displaying Subforms

Hi guys 'n gals,

Is it possible to have a sub-form in C#? Basically, I am curious if I could attach a small Form inside a larger Form, so the form would be able to drag around inside the larger form. In a way it would be bound to the the larger form.

Any ideas?

Who is Participating?
RizwanKhalidConnect With a Mentor Commented:
1) Create two forms named form1 and form2
2) set from1.IsMdiContainer = true; You can do this in the designer of the form.
3) create a new form2 in some function as form2 frm = new form2();
4) set frm.MdiParent = this; instead of this, you can use the name of form1 whatever it is.

If you want a code snippet of the classes, please ask.
Daniel ReynoldsSoftware Applications Developer / IntegratorCommented:
in the properties for the form, set IsMdiContainer = true
Bob LearnedConnect With a Mentor Commented:
You can have forms as child controls in a parent form, without having to resort to using MDI properties.  

Form2 f = new Form2();
f.TopLevel = false;
f.Parent = this;

Cyber-DrugsAuthor Commented:
Cheers guys!
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.